<template>
    <div>
        <!--商机信息-->
        <div style="border:1px solid #BFBFBF;padding: 10px;background-color: white;height: 220px">
            <!--上-->
            <el-form v-model="businessform" :label-position="labelPosition" >
                <div>
                    <el-row style="height:41px">
                        <el-col :span="18" >
                            <el-form-item>
                                <i class="el-icon-share" style="padding-left: 0px;font-size: 25px;"></i>
                                <span style="font-weight: bold;font-size: 18px;margin-left: 10px">{{businessform.busName}}</span>
                            </el-form-item>
                        </el-col>
                        <el-col :span="6">
                            <el-form-item>
                                <span style="display: none">{{businessform.busId}}</span>
                                <el-button class="el-icon-edit" @click="editbus(businessform.busId)" style="margin-left: 100px">编辑</el-button>
                                <el-button class="el-icon-back">返回</el-button>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </div>
                <!--下-->
                <div style="border-top: 1px solid #DDDDDD;margin-top: 10px">
                    <div style="height: 150px;margin-left: 10px;">
                        <el-row type="flex" style="margin-top: 20px">
                            <el-col :span="2">
                                <span style="color: gray">商机名称：</span>
                            </el-col>
                            <el-col :span="10">
                                <span style="color: black">{{businessform.busName}}</span>
                            </el-col>
                            <el-col :span="2">
                                <span style="color: gray">商机编号：</span>
                            </el-col>
                            <el-col :span="4">
                                <span style="color: black">{{businessform.busNo}}</span>
                            </el-col>
                        </el-row>
                        <el-row type="flex" style="margin-top: 15px">
                            <el-col :span="2">
                                <span style="color: gray">客户名称：</span>
                            </el-col>
                            <el-col :span="10">
                                <span style="color: black">{{businessform.client.clientName}}</span>
                            </el-col>
                            <el-col :span="2">
                                <span style="color: gray">预期金额：</span>
                            </el-col>
                            <el-col :span="4">
                                <span style="color: red">{{businessform.busMoney}}</span>
                            </el-col>
                        </el-row>
                        <el-row type="flex" style="margin-top: 15px">
                            <el-col :span="2">
                                <span style="color: gray">联系人：</span>
                            </el-col>
                            <el-col :span="10">
                                <span style="color: black">{{businessform.busPrimarycontact.linkmanName}}</span>
                            </el-col>
                            <el-col :span="2">
                                <span style="color: gray">阶段：</span>
                            </el-col>
                            <el-col :span="4">
                                <span style="color: black">{{businessform.phase.phaseName}}</span>
                            </el-col>
                        </el-row>
                        <el-row type="flex" style="margin-top: 15px">
                            <el-col :span="2">
                                <span style="color: gray">可能性：</span>
                            </el-col>
                            <el-col :span="10">
                                <span style="color: black">{{businessform.busPossibility}}</span>
                            </el-col>
                            <el-col :span="2">
                                <span style="color: gray">建立时间：</span>
                            </el-col>
                            <el-col :span="4">
                                <span style="color: black">{{businessform.busSettime | formatDate}}</span>
                            </el-col>
                        </el-row>
                    </div>
                </div>
            </el-form>
        </div>
        <!--进度-->
        <div style="margin-top: 10px;border: 1px solid #BFBFBF;background-color: white;height: 90px">
            <div style="margin-top: 20px">
                <el-steps :active="businessform.phase.phaseId" align-center>

                    <el-step :title="v.phaseName" v-for=" v in phaseoptions" :key="v.phaseId"></el-step>

                </el-steps>
            </div>
        </div>
        <!--进度详情-->
        <div style="margin-top: 10px;border: 1px solid #BFBFBF;background-color: white;">
            <div>
                <template>
                    <el-tabs v-model="activeName2" type="card" @tab-click="handleClick">
                        <el-tab-pane label="跟踪记录" name="first">
                            <div>
                                <div style="width: 970px;margin: 10px 150px">
                                    <!--添加记录框-->
                                    <div @click="showjl" style="width: 970px;height:100px">
                                        <el-input type="textarea" placeholder="添加跟进记录" id="log-text"
                                                  style="resize:none;height: 80px;width: 972px"
                                                  @change="ctails"
                                                  cols="30" rows="4" v-model="bustails.tailRecord"></el-input>
                                    </div>
                                    <!--记录值div-->
                                    <div v-show="jl" style="margin-top: 20px;border: 1px solid #D8E3EF;width: 970px;height: 200px">
                                        <el-form :model="bustails" ref="bustails" :rules="rules" :label-position="formright" label-width="120px">
                                            <el-row>
                                                <el-col :span="12">
                                                    <el-form-item label="跟进类型"
                                                                  prop="type.typeId"
                                                                  style="width: 420px;margin-top: 10px;">
                                                        <el-select v-model="bustails.type" @change="selectttembytypeId" value-key="typeId" clearable placeholder="请选择">
                                                            <el-option
                                                                    v-for="item in typeoptions"
                                                                    :key="item.typeId"
                                                                    :label="item.typeName"
                                                                    :value="item">
                                                            </el-option>
                                                        </el-select>
                                                    </el-form-item>
                                                </el-col>
                                                <el-col :span="8">
                                                    <el-form-item label="快捷添加"
                                                                  style="width: 420px;margin-top: 10px">
                                                        <el-select v-model="bustails.ttemplateId"
                                                                    value-key="ttemplateId"
                                                                   @change="changenote()"
                                                                   clearable placeholder="请选择">
                                                            <el-option
                                                                    v-for="(item) in ttemplateoptions"
                                                                    :key="item.ttemplateId"
                                                                    :label="item.ttemplateNote"
                                                                    :value="item">
                                                            </el-option>
                                                        </el-select>
                                                        <i class="el-icon-setting" id="setting" @click="isMoban=true"></i>
                                                    </el-form-item>
                                                </el-col>
                                            </el-row>
                                            <el-row>
                                                <el-col :span="12">
                                                    <el-form-item label="下次联系时间"
                                                                  style="width: 420px;margin-top: 10px">
                                                        <el-date-picker
                                                                v-model="bustails.tailNexttime"
                                                                type="date"
                                                                placeholder="选择日期">
                                                        </el-date-picker>
                                                    </el-form-item>
                                                </el-col>
                                                <el-col :span="8">
                                                    <el-form-item label="保存为跟进模板"
                                                                  style="width: 420px;margin-top: 10px">
                                                        <el-checkbox v-model="checked" ></el-checkbox>
                                                    </el-form-item>
                                                </el-col>
                                            </el-row>
                                            <el-row>
                                                <el-button style="margin-left: 800px"  @click="canceladdtails"
                                                           size="small" type="primary" plain>收起</el-button>
                                                <el-button style="margin-left: 10px"  @click="addtails('bustails')"
                                                           size="small" type="primary" plain>保存</el-button>
                                            </el-row>
                                        </el-form>
                                    </div>
                                    <!--跟进记录-->
                                    <div style="margin-top: 20px;border: 1px solid #D8E3EF;width: 970px;">
                                        <div style="margin-top: 10px">
                                            <el-timeline>
                                                <el-timeline-item v-for="(item) in tailslist" :key="item.tailId" :timestamp="item.tailNowtime | formatDate" placement="top">
                                                    <el-card style="height: 165px">
                                                        <img src="../assets/strat1.png" style="width: 35px;height: 35px">
                                                        <span style="margin-top: -10px;margin-left: 10px;color: #337AB7">{{item.tailPeople}}</span>
                                                        <span style="margin-top: -10px;margin-left: 10px;color: #BFBFBF">发布了一条快速记录</span>
                                                        <span style="margin-top: -10px;margin-left: 10px;color: #BFBFBF">{{item.tailNowtime | formatDate}}</span>
                                                        <span style="margin-top: -10px;margin-left: 10px;color: #337AB7">{{item.type.typeName}}</span>
                                                        <div style="margin-top: 10px;margin-left: 44px">
                                                            {{item.tailRecord}}
                                                        </div>
                                                        <p style="margin-top: 10px;margin-left: 44px;color: #BFBFBF">相关商机：{{item.busId.busNo}}</p>
                                                        <span style="margin-left: 620px;color: #BFBFBF">下次联系时间：{{item.tailNexttime | formatDate}}</span>
                                                    </el-card>
                                                </el-timeline-item>
                                            </el-timeline>
                                        </div>
                                    </div>

                                    <!--留下多余位置-->
                                    <div style="height: 100px">

                                    </div>
                                </div>
                            </div>
                        </el-tab-pane>
                        <el-tab-pane label="客户需求" name="second">
                            <div>
                                <!--客户需求-->
                                <div style="width: 970px;margin: 10px 150px;">
                                    <div>
                                        <!--添加记录框-->
                                        <div @click="showprojl" style="width: 970px;height:100px">
                                            <el-input type="textarea" placeholder="添加需求内容" id="log-text2"
                                                      style="resize:none;height: 80px;width: 972px"
                                                      @change="cnote()"
                                                      cols="30" rows="4" v-model="needfrom.needNote"></el-input>
                                        </div>
                                        <!--记录值div-->
                                        <div v-show="projl" style="margin-top: 20px;border: 1px solid #D8E3EF;width: 970px;height: 270px">
                                            <el-form :label-position="formright" :model="needfrom" ref="needfrom" :rules="needrules" label-width="120px">
                                                <el-row>
                                                    <el-col :span="12">
                                                        <el-form-item label="需求主题"
                                                                      style="width: 420px;margin-top: 10px" prop="needTheme">
                                                            <el-input style="width: 215px" v-model="needfrom.needTheme"></el-input>
                                                        </el-form-item>
                                                    </el-col>
                                                    <el-col :span="8">
                                                        <el-form-item label="客户"
                                                                      style="width: 320px;margin-top: 10px">
                                                            <el-input :disabled="true" style="width: 215px" v-model="businessform.client.clientName"></el-input>
                                                        </el-form-item>
                                                    </el-col>
                                                </el-row>
                                                <el-row>
                                                    <el-col :span="12">
                                                        <el-form-item label="提供人"
                                                                      style="width: 420px;margin-top: 10px;" required>
                                                            <el-input :disabled="true" style="width: 215px" v-model="needfrom.needPeople"></el-input>
                                                        </el-form-item>
                                                    </el-col>
                                                    <el-col :span="8">
                                                        <el-form-item label="快捷添加" prop="a"
                                                                      style="width: 420px;margin-top: 10px">
                                                            <el-select v-model="needfrom.ntemplateId" value-key="ntemplateId"
                                                                       @change="changeneed()"
                                                                       style="" clearable placeholder="请选择">
                                                                <el-option
                                                                        v-for="item in needoptions"
                                                                        :key="item.ntemplateId"
                                                                        :label="item.ntemplateNote"
                                                                        :value="item">
                                                                </el-option>
                                                            </el-select>
                                                            <i class="el-icon-setting" id="setting1" @click="isneed=true"></i>
                                                        </el-form-item>
                                                    </el-col>
                                                </el-row>
                                                <el-row>
                                                    <el-col :span="12">
                                                        <el-form-item label="记录时间"
                                                                      style="width: 420px;margin-top: 10px">
                                                            <el-date-picker
                                                                    v-model="needfrom.needNowtime"
                                                                    type="date"
                                                                    :disabled="true"
                                                                    format="yyyy 年 MM 月 dd 日"
                                                                    value-format="yyyy-MM-dd"
                                                                    placeholder="选择日期">
                                                            </el-date-picker>
                                                        </el-form-item>
                                                    </el-col>
                                                    <el-col :span="8">
                                                        <el-form-item label="保存为需求模板" prop="a"
                                                                      style="width: 420px;margin-top: 10px">
                                                            <el-checkbox v-model="checked2" ></el-checkbox>
                                                        </el-form-item>
                                                    </el-col>
                                                </el-row>
                                                <el-row>
                                                    <el-button style="margin-left: 800px" @click="canceladdneeds" size="small" type="primary" plain>收起</el-button>
                                                    <el-button style="margin-left: 10px" @click="addneeds('needfrom')" size="small" type="primary" plain>保存</el-button>
                                                </el-row>
                                            </el-form>
                                        </div>
                                        <!--需求记录-->
                                        <div style="margin-top: 20px;border: 1px solid #D8E3EF;width: 970px">
                                            <div style="margin-top: 10px">
                                                <el-table
                                                        :data="needlist"
                                                        style="width: 100%">
                                                    <el-table-column type="expand">
                                                        <template slot-scope="props">
                                                            <el-form label-position="left" inline class="demo-table-expand">
                                                                <el-form-item label="需求主题">
                                                                    <span>{{ props.row.needTheme }}</span>
                                                                </el-form-item>
                                                                <el-form-item label="记录时间">
                                                                    <span>{{ props.row.needNowtime | formatDate}}</span>
                                                                </el-form-item>
                                                                <el-form-item label="需求提供人">
                                                                    <span>{{ props.row.needPeople }}</span>
                                                                </el-form-item>
                                                                <el-form-item label="需求内容">
                                                                    <span>{{ props.row.needNote }}</span>
                                                                </el-form-item>
                                                            </el-form>
                                                        </template>
                                                    </el-table-column>
                                                    <el-table-column
                                                            label="需求主题"
                                                            prop="needTheme">
                                                    </el-table-column>
                                                    <el-table-column
                                                            label="记录时间">
                                                        <template slot-scope="s">
                                                            {{s.row.needNowtime | formatDate}}
                                                        </template>
                                                    </el-table-column>
                                                    <el-table-column
                                                            label="需求提供人"
                                                            prop="needPeople">
                                                    </el-table-column>
                                                </el-table>
                                            </div>
                                        </div>
                                        <!--留下多余位置-->
                                        <div style="height: 100px">

                                        </div>
                                    </div>
                                </div>
                            </div>
                        </el-tab-pane>
                        <el-tab-pane label="竞争机会" name="third">
                            <div>
                                <!--竞争对手-->
                                <div style="width: 970px;margin: 10px 150px">
                                    <div>
                                        <el-button style="margin-left: 880px" size="small" @click="vieShows" type="primary" plain>添加机会</el-button>
                                    </div>
                                    <!--添加对手框-->
                                    <div v-show="vieshow">
                                        <div style="margin-top: 20px;border: 1px solid #D8E3EF;width: 970px;height: 350px">
                                            <el-form :label-position="formright" :model="viefrom" ref="viefrom" :rules="vierules" label-width="120px">
                                                <el-row>
                                                    <el-col :span="12">
                                                        <el-form-item label="机会名称"
                                                                      style="width: 420px;margin-top: 10px" prop="bvieName">
                                                            <el-input style="width: 215px" v-model="viefrom.bvieName"></el-input>
                                                        </el-form-item>
                                                    </el-col>
                                                    <el-col :span="8">
                                                        <el-form-item label="客户"
                                                                      style="width: 320px;margin-top: 10px">
                                                            <el-input :disabled="true" style="width: 215px" v-model="businessform.client.clientName"></el-input>
                                                        </el-form-item>
                                                    </el-col>
                                                </el-row>
                                                <el-row>
                                                    <el-col :span="12">
                                                        <el-form-item label="公司名称"
                                                                      style="width: 420px;margin-top: 10px" prop="vie.vieName">
                                                            <el-input @focus="showvies" style="width: 215px" v-model="viefrom.vie.vieName"></el-input>
                                                        </el-form-item>

                                                    </el-col>
                                                    <el-col :span="8">
                                                        <el-form-item label="对应商机"
                                                                      style="width: 420px;margin-top: 10px">
                                                            <el-input :disabled="true" v-model="businessform.busNo" style="width: 215px"></el-input>
                                                        </el-form-item>
                                                    </el-col>

                                                </el-row>
                                                <el-row>
                                                    <el-col :span="12">
                                                        <el-form-item label="竞争产品"
                                                                      style="width: 420px;margin-top: 10px">
                                                            <el-input @focus="showviepros" style="width: 215px" v-model="viepros"></el-input>
                                                        </el-form-item>
                                                    </el-col>
                                                    <el-col :span="8">
                                                        <el-form-item label="对方价格"
                                                                      style="width: 420px;margin-top: 10px">
                                                            <el-input style="width: 215px"  @input="checkInput" v-model="viefrom.bvieMoney"></el-input>
                                                        </el-form-item>
                                                    </el-col>

                                                </el-row>
                                                <el-row>
                                                    <el-col :span="12">
                                                        <el-form-item label="竞争力" prop="bviePower"
                                                                      style="width: 420px;margin-top: 10px">
                                                            <el-radio-group v-model="viefrom.bviePower">
                                                                <el-radio :label="1">弱项竞争</el-radio>
                                                                <el-radio :label="2">一般竞争</el-radio>
                                                                <el-radio :label="3">强项竞争</el-radio>
                                                            </el-radio-group>
                                                        </el-form-item>
                                                    </el-col>
                                                </el-row>
                                                <el-row>
                                                    <el-button @click="canceladdvie" style="margin-left: 800px" size="small" type="primary" plain>收起</el-button>
                                                    <el-button @click="addvie('viefrom')" style="margin-left: 10px" size="small" type="primary" plain>保存</el-button>
                                                </el-row>
                                            </el-form>
                                        </div>
                                    </div>
                                    <!--对手表格-->
                                    <div>
                                        <div style="border: 1px solid #EBEEF5;margin-top: 30px">
                                            <el-table
                                                    :data="busvielist"
                                                    style="width: 100%">
                                                <el-table-column type="expand">
                                                    <template slot-scope="props">
                                                        <el-form label-position="left" inline class="demo-table-expand">
                                                            <el-form-item label="机会名称">
                                                                <span>{{ props.row.bvieName }}</span>
                                                            </el-form-item>
                                                            <el-form-item label="公司名称">
                                                                <span>{{ props.row.vie.vieName }}</span>
                                                            </el-form-item>
                                                            <el-form-item label="对应商机">
                                                                <span>{{businessform.busNo}}</span>
                                                            </el-form-item>
                                                            <el-form-item label="客户">
                                                                <span>{{businessform.client.clientName}}</span>
                                                            </el-form-item>
                                                            <el-form-item label="对方报价">
                                                                <span>{{ props.row.bvieMoney }}</span>
                                                            </el-form-item>
                                                            <el-form-item label="优势">
                                                                <span>{{ props.row.vie.vvieStrategy}}</span>
                                                            </el-form-item>
                                                            <el-form-item label="劣势">
                                                                <span>{{ props.row.vie.vieInferior }}</span>
                                                            </el-form-item>
                                                            <el-form-item label="竞争产品">
                                                                <span v-for="pro in props.row.viepros" :key="pro.vpros.vproName">
                                                                    {{pro.vpros.vproName}}
                                                                </span>
                                                            </el-form-item>
                                                        </el-form>
                                                    </template>
                                                </el-table-column>
                                                <el-table-column
                                                        label="机会名称"
                                                        prop="bvieName">
                                                </el-table-column>
                                                <el-table-column
                                                        label="公司名称"
                                                        prop="vie.vieName">
                                                </el-table-column>
                                                <el-table-column
                                                        label="对应商机">
                                                    <template>
                                                        {{mybusno}}
                                                    </template>
                                                </el-table-column>
                                                <el-table-column
                                                        label="客户">
                                                    <template>
                                                        {{myclientname}}
                                                    </template>
                                                </el-table-column>
                                                <el-table-column
                                                        align="center"
                                                        label="操作"
                                                        width="70">
                                                    <template slot-scope="s">
                                                        <i @click="detvie(s.row.bvieId)" style="font-size:18px;padding-left: 20px;color: #409EFF" class="el-icon-delete"></i>
                                                    </template>
                                                </el-table-column>
                                            </el-table>
                                        </div>
                                    </div>
                                    <!--留下多余位置-->
                                    <div style="height: 100px">

                                    </div>
                                </div>
                            </div>
                        </el-tab-pane>
                        <el-tab-pane label="联系人" name="six">
                            <div>
                                <!--联系人-->
                                <div style="width: 970px;margin: 10px 150px">
                                    <!--联系人操作-->
                                    <div>
                                        <el-button style="margin-left: 870px" size="small" type="primary" plain @click="showaddlxr">更改联系人</el-button>
                                    </div>
                                    <!--联系人表格-->
                                    <div style="margin-top: 30px;border: 1px solid #EBEEF5">
                                        <el-table
                                                :data="linkmantables"
                                                style="width: 100%"
                                                max-height="380">
                                            <el-table-column
                                                    prop="linkmanName"
                                                    label="姓名"
                                                    align="center">
                                            </el-table-column>
                                            <el-table-column
                                                    prop="linkmanMobile"
                                                    label="电话号码"
                                                    align="center">
                                            </el-table-column>
                                            <el-table-column
                                                    prop="linkmanPosition"
                                                    label="职务"
                                                    align="center">
                                            </el-table-column>
                                            <el-table-column
                                                    prop="linkmanSex"
                                                    label="性别"
                                                    align="center">
                                            </el-table-column>
                                        </el-table>
                                    </div>

                                    <!--留下多余位置-->
                                    <div style="height: 100px">

                                    </div>
                                </div>
                            </div>

                        </el-tab-pane>
                        <el-tab-pane label="解决方案" name="fourth" :disabled="one">
                            <div>
                                <!--解决方案-->
                                <div style="width: 970px;margin: 10px 150px">
                                    <div>
                                        <el-button style="margin-left: 880px" size="small" @click="schemeShows" type="primary" plain>添加方案</el-button>
                                    </div>
                                    <!--添加对手框-->
                                    <div v-show="schemeshow">
                                        <div style="margin-top: 20px;border: 1px solid #D8E3EF;width: 970px;height: 440px">
                                            <el-form :model="schemefrom" ref="schemefrom" :rules="schemerule" :label-position="formright" label-width="120px">
                                                <el-row>
                                                    <el-col :span="12">
                                                        <el-form-item label="方案主题"
                                                                      style="width: 420px;margin-top: 10px" prop="schemeTheme">
                                                            <el-input style="width: 215px" :disabled="myclientflag" v-model="schemefrom.schemeTheme"></el-input>
                                                        </el-form-item>
                                                    </el-col>
                                                    <el-col :span="8">
                                                        <el-form-item label="客户"
                                                                      style="width: 320px;margin-top: 10px">
                                                            <el-input :disabled="true" style="width: 215px" v-model="businessform.client.clientName"></el-input>
                                                        </el-form-item>
                                                    </el-col>
                                                </el-row>
                                                <el-row>
                                                    <el-col :span="12">
                                                        <el-form-item label="对应商机"
                                                                      style="width: 420px;margin-top: 10px">
                                                            <el-input :disabled="true" v-model="businessform.busNo" style="width: 215px"></el-input>
                                                        </el-form-item>
                                                    </el-col>
                                                    <el-col :span="8">
                                                        <el-form-item label="提交时间"
                                                                      style="width: 420px;margin-top: 10px;">
                                                            <el-date-picker
                                                                    v-model="schemefrom.schemeNowtime"
                                                                    type="date"
                                                                    :disabled="true"
                                                                    format="yyyy 年 MM 月 dd 日"
                                                                    value-format="yyyy-MM-dd"
                                                                    placeholder="选择日期">
                                                            </el-date-picker>
                                                        </el-form-item>
                                                    </el-col>
                                                </el-row>
                                                <el-row>
                                                    <el-col :span="12">
                                                        <el-form-item label="解决类型"
                                                                      style="width: 420px;margin-top: 10px" prop="schemeType">
                                                            <el-select style="width:215px"  :disabled="myclientflag" @change="changedemand" v-model="schemefrom.schemeType" value-key="schemeType" placeholder="请选择">
                                                                <el-option
                                                                        v-for="item in schemeTypeoptions"
                                                                        :key="item.id"
                                                                        :label="item.name"
                                                                        :value="item.name">
                                                                </el-option>
                                                            </el-select>
                                                        </el-form-item>
                                                    </el-col>
                                                    <el-col :span="8">
                                                        <el-form-item label="选择需求"
                                                                      style="width: 420px;margin-top: 10px;" prop="schemeDemand">
                                                            <el-select :disabled="myclientflag" style="width:215px" v-model="schemefrom.schemeDemand" value-key="schemeDemand" placeholder="请选择">
                                                                <el-option
                                                                        v-for="item in schemeDemandoptions"
                                                                        :key="item.myid"
                                                                        :label="item.myname"
                                                                        :value="item.myid">
                                                                </el-option>
                                                            </el-select>
                                                        </el-form-item>
                                                    </el-col>
                                                </el-row>
                                                <el-row>
                                                    <el-col :span="12">
                                                        <el-form-item label="方案内容"
                                                                      style="width: 720px;margin-top: 10px" prop="schemeRecord">
                                                            <el-input type="textarea" placeholder="添加方案内容" id="log-text9"
                                                                      style="resize:none;width: 420px"
                                                                      cols="24" rows="2" v-model="schemefrom.schemeRecord"></el-input>
                                                        </el-form-item>
                                                    </el-col>
                                                </el-row>
                                                <el-row>
                                                    <el-col :span="12">
                                                        <el-form-item label="客户反馈"
                                                                      style="width: 720px;margin-top: 10px" prop="schemeFeedback">
                                                            <el-input type="textarea" placeholder="添加客户反馈" id="log-text10"
                                                                      style="resize:none;width: 420px"
                                                                      cols="24" rows="2" v-model="schemefrom.schemeFeedback"></el-input>
                                                        </el-form-item>
                                                    </el-col>
                                                </el-row>
                                                <el-row>
                                                    <el-button @click="canceladdscheme()" style="margin-left: 800px" size="small" type="primary" plain>收起</el-button>
                                                    <el-button @click="addscheme('schemefrom')" style="margin-left: 10px" size="small" type="primary" plain>保存</el-button>
                                                </el-row>
                                            </el-form>
                                        </div>
                                    </div>
                                    <!--解决方案记录-->
                                    <div>
                                        <div style="margin-top: 20px;border: 1px solid #D8E3EF;width: 970px;">
                                            <div style="margin-top: 10px">
                                                <el-timeline>
                                                    <el-timeline-item  v-for="(item) in schemelist" :key="item.schemeId" :timestamp="item.schemeNowtime | formatDate" placement="top">
                                                        <el-card style="height: 165px">
                                                            <img src="../assets/strat1.png" style="width: 35px;height: 35px">
                                                            <span style="margin-top: -10px;margin-left: 10px;color: #337AB7">{{item.schemePeople}}</span>
                                                            <span style="margin-top: -10px;margin-left: 10px;color: #BFBFBF">发布了一条解决方案</span>
                                                            <span style="margin-top: -10px;margin-left: 10px;color: #337AB7">{{item.schemeTheme}}</span>
                                                            <span style="margin-top: -10px;margin-left: 10px;color: #BFBFBF">{{item.schemeNowtime | formatDate}}</span>
                                                            <span style="margin-top: -10px;margin-left: 10px;color: #BFBFBF">解决类型：</span>
                                                            <span style="margin-top: -10px;margin-left: 10px;color: #337AB7">{{item.schemeType}}</span>
                                                            <span style="margin-top: -10px;margin-left: 10px;color: #BFBFBF">需求名称：</span>
                                                            <span v-if="item.schemeType=='竞争对手'" style="margin-top: -10px;margin-left: 10px;color: #337AB7">{{item.bvieName}}</span>
                                                            <span v-if="item.schemeType=='客户需求'" style="margin-top: -10px;margin-left: 10px;color: #337AB7">{{item.needTheme}}</span>
                                                            <el-dropdown  style="float: right">
                                                                <span class="el-dropdown-link">
                                                                    <i class="el-icon-arrow-down el-icon--right"></i>
                                                                </span>
                                                                <el-dropdown-menu slot="dropdown">
                                                                    <el-dropdown-item split-button="true" @click.native="editscheme(item)">编辑</el-dropdown-item>
                                                                </el-dropdown-menu>
                                                            </el-dropdown>
                                                            <div style="margin-top: 10px;margin-left: 44px">
                                                                {{item.schemeRecord}}
                                                            </div>
                                                            <p style="margin-top: 10px;margin-left: 44px;color: #BFBFBF">相关商机：{{businessform.busNo}}</p>
                                                        </el-card>
                                                    </el-timeline-item>
                                                </el-timeline>
                                            </div>
                                        </div>
                                    </div>
                                    <!--留下多余位置-->
                                    <div style="height: 100px">

                                    </div>
                                </div>
                            </div>
                        </el-tab-pane>
                        <el-tab-pane label="产品详情" name="five" :disabled="two">
                            <div>
                                <!--产品信息-->
                                <div style="width: 970px;margin: 10px 150px">
                                    <!--添加产品-->
                                    <div>
                                        <el-button v-show="ofshow" style="margin-left: 880px" size="small" @click="showprotab" type="primary" plain>编辑产品</el-button>
                                    </div>
                                    <!--产品表格-->
                                    <div style="border: 1px solid #EBEEF5;margin-top: 30px">
                                        <el-table
                                                :data="dbuspros"
                                                style="width: 99%;margin-left: 10px;font-size:13px">
                                            <el-table-column
                                                    align="center"
                                                    prop="productId.productName"
                                                    label="产品名称"
                                                    width="200">
                                            </el-table-column>
                                            <el-table-column
                                                    align="center"
                                                    label="产品规格"
                                                    width="180">
                                                <template slot-scope="s">
                                        <span v-for="pro in s.row.qmodeldetails" :key="pro.prodetailId">
                                            {{pro.modetContent}}
                                        </span>
                                                </template>
                                            </el-table-column>
                                            <el-table-column
                                                    align="center"
                                                    prop="prodetaiJpri"
                                                    label="进价"
                                                    width="90">
                                            </el-table-column>
                                            <el-table-column
                                                    align="center"
                                                    label="售价"
                                                    width="90">
                                                <template slot-scope="d">
                                                    <span>{{d.row.prodetailSpri}}</span>
                                                </template>
                                            </el-table-column>
                                            <el-table-column
                                                    prop="busproNum"
                                                    align="center"
                                                    label="数量"
                                                    width="150">
                                            </el-table-column>
                                            <el-table-column
                                                    align="center"
                                                    prop="busproDeiscount"
                                                    label="折扣（%）"
                                                    width="120">
                                            </el-table-column>
                                            <el-table-column
                                                    align="center"
                                                    prop="busproTotal"
                                                    label="合计"
                                                    width="120">
                                            </el-table-column>
                                        </el-table>
                                    </div>
                                    <!--小计-->
                                    <div style="margin-top: 30px;height: 20px;margin-left: 640px;;font-size: 13px">
                                        <span>
                                            相关商机:
                                        </span>
                                        <span style="color: #BFBFBF">
                                             {{businessform.busNo}}
                                        </span>
                                        <span>
                                            产品合计(元):
                                        </span>
                                        <span  style="color: #BFBFBF">
                                        {{outcount}}
                                        </span>
                                    </div>
                                    <div style="margin-top: 10px;border-bottom: 1px dotted #BFBFBF;"></div>

                                    <!--留下多余位置-->
                                    <div style="height: 100px">

                                    </div>
                                </div>
                            </div>
                        </el-tab-pane>
                        <el-tab-pane label="报价" name="seven" :disabled="three">
                            <div>
                                <!--报价信息-->
                                <div style="width: 970px;margin: 10px 150px">
                                    <div>
                                        <el-button v-show="ofshow" style="margin-left: 880px" size="small" @click="offerShows" type="primary" plain>添加报价</el-button>
                                    </div>
                                    <!--报价框-->
                                    <div v-show="offershow">
                                        <div style="margin-top: 20px;border: 1px solid #D8E3EF;width: 970px;height: 520px">
                                            <el-form :model="offerfrom" ref="offerfrom" :rules="offerrules" :label-position="formright" label-width="120px">
                                                <el-row>
                                                    <el-col :span="12">
                                                        <el-form-item label="报价主题" prop="offerTheme"
                                                                      style="width: 420px;margin-top: 10px">
                                                            <el-input style="width: 215px" v-model="offerfrom.offerTheme"></el-input>
                                                        </el-form-item>

                                                    </el-col>
                                                    <el-col :span="8">
                                                        <el-form-item label="报价单号"
                                                                      style="width: 420px;margin-top: 10px">
                                                            <el-input :disabled="true" v-model="offerfrom.offerNumbers" style="width: 215px"></el-input>
                                                        </el-form-item>

                                                    </el-col>
                                                </el-row>
                                                <el-row>
                                                    <el-col :span="12">
                                                        <el-form-item label="对应商机"
                                                                      style="width: 420px;margin-top: 10px">
                                                            <el-input :disabled="true" v-model="businessform.busNo" style="width: 215px"></el-input>
                                                        </el-form-item>
                                                    </el-col>
                                                    <el-col :span="8">
                                                        <el-form-item label="对应客户"
                                                                      style="width: 320px;margin-top: 10px">

                                                            <el-input :disabled="true" style="width: 215px" v-model="businessform.client.clientName"></el-input>
                                                        </el-form-item>
                                                    </el-col>
                                                </el-row>
                                                <el-row>
                                                    <el-col :span="12">
                                                        <el-form-item label="报价人"
                                                                      style="width: 420px;margin-top: 10px">
                                                            <el-input style="width: 215px" :disabled="true" v-model="offerfrom.offerPeople"></el-input>
                                                        </el-form-item>
                                                    </el-col>
                                                    <el-col :span="8">
                                                        <el-form-item label="接收人"
                                                                      style="width: 420px;margin-top: 10px">
                                                            <el-input style="width: 215px" :disabled="true" v-model="businessform.busPrimarycontact.linkmanName"></el-input>
                                                        </el-form-item>
                                                    </el-col>
                                                </el-row>
                                                <el-row>
                                                    <el-col :span="12">
                                                        <el-form-item label="报价金额"
                                                                      style="width: 420px;margin-top: 10px">
                                                            <el-input style="width: 215px" :disabled="true" v-model="offerfrom.offerMoney"></el-input>
                                                        </el-form-item>
                                                    </el-col>
                                                    <el-col :span="8">
                                                        <el-form-item label="毛利"
                                                                      style="width: 420px;margin-top: 10px">
                                                            <el-input :disabled="true" style="width: 215px" v-model="offerfrom.offerProfit"></el-input>
                                                        </el-form-item>
                                                    </el-col>
                                                </el-row>
                                                <el-row>
                                                    <el-col :span="12">
                                                        <el-form-item label="备注"
                                                                      style="width: 620px;margin-top: 10px">
                                                            <el-input type="textarea" placeholder="添加报价备注" id="log-text4"
                                                                      style="resize:none;width: 320px"
                                                                      cols="24" rows="3" v-model="offerfrom.offerNote"></el-input>
                                                        </el-form-item>
                                                    </el-col>
                                                    <el-col :span="8">
                                                        <el-form-item label="审批人" prop="offerExamine"
                                                                      style="width: 420px;margin-top: 10px">
                                                            <el-select v-model="offerfrom.offerExamine"  value-key="empId" placeholder="请选择">
                                                                <el-option-group
                                                                        v-for="group in appofferOptions"
                                                                        :key="group.depId"
                                                                        :label="group.depName">
                                                                    <el-option
                                                                            v-for="item in group.qempdepid"
                                                                            :key="item.empId"
                                                                            :label="item.empName"
                                                                            :value="item">
                                                                    </el-option>
                                                                </el-option-group>
                                                            </el-select>
                                                        </el-form-item>
                                                    </el-col>
                                                </el-row>
                                                <el-row>
                                                    <el-button @click="addoffer('offerfrom')" style="margin-left: 880px" size="small" type="primary" plain>保存</el-button>
                                                </el-row>
                                            </el-form>
                                        </div>
                                    </div>
                                    <!--报价记录-->
                                    <div>
                                        <div style="border: 1px solid #EBEEF5;margin-top: 30px">
                                            <el-table
                                                    :data="offerList"
                                                    style="width: 100%"
                                                    max-height="300"
                                                    :default-sort = "{prop: 'date', order: 'descending'}">
                                                <el-table-column
                                                        fixed
                                                        label="报价主题"
                                                        sortable
                                                        align="center">
                                                    <template slot-scope="sp">
                                                        <a v-html="sp.row.offerTheme" @click="todetails(sp.row)"></a>
                                                    </template>
                                                </el-table-column>
                                                <el-table-column
                                                        prop="business.busNo"
                                                        label="对应商机"
                                                        align="center">
                                                </el-table-column>
                                                <el-table-column
                                                        prop="client.clientName"
                                                        label="客户"
                                                        align="center">
                                                </el-table-column>
                                                <el-table-column
                                                        prop="offerMoney"
                                                        label="报价金额"
                                                        width="80"
                                                        align="center">
                                                </el-table-column>
                                                <el-table-column
                                                        label="时间"
                                                        align="center">
                                                    <template slot-scope="s">
                                                        {{s.row.offerTime | formatDate}}
                                                    </template>
                                                </el-table-column>
                                                <el-table-column
                                                        prop="offerAudit"
                                                        label="审核状态"
                                                        width="80"
                                                        align="center">
                                                </el-table-column>
                                                <el-table-column
                                                        label="操作"
                                                        align="center">
                                                    <template slot-scope="sp">
                                                        <el-link v-if="sp.row.offerAccept=='已接受'" :underline="false" disabled>已接受</el-link>
                                                        <el-link v-show="!weiwei" v-if="sp.row.offerAudit == '已审核' && sp.row.offerAccept=='未接受'" :underline="false" @click="setaccpe(sp.row)">设为已接受</el-link>
                                                        <!--<el-link :disabled="weiwei" :underline="false" @click="setaccpe(sp.row)"></el-link>-->
                                                    </template>
                                                </el-table-column>
                                            </el-table>
                                        </div>
                                    </div>
                                    <!--留下多余位置-->
                                    <div style="height: 100px">

                                    </div>
                                </div>
                            </div>
                        </el-tab-pane>
                    </el-tabs>
                </template>
            </div>
        </div>
        <!--编辑产品弹框-->
        <el-dialog width="800px" center :close-on-click-modal=false style="text-align: left" title="编辑产品" :visible.sync="jilutankuan">
            <div style="height:430px;" class="scrollbar">
                <el-scrollbar style="height:100%">
                    <!--上-->
                    <div style="height:50px;width: 735px">
                        <span>批量操作：</span>
                        <el-button size="mini" @click="editdetpros()">删除</el-button>
                        <span style="margin-left: 360px">共选择{{prosize}}个产品</span>
                        <span style="margin-left: 40px;color: #409EFF" class="apro" @click="showaddprotab">+添加产品</span>
                    </div>
                    <!--中-->
                    <div style="border: 1px solid #EBEEF5;width: 745px">
                        <div style="width: 99%;margin: 0 auto">
                            <el-table
                                    :data="proList"
                                    style="width: 99%;margin-left: 10px;font-size:13px"
                                    height="280px"
                                    @selection-change="oneSelectionChange">
                                <el-table-column
                                        prop="prodetailId"
                                        type="selection"
                                        width="50"
                                        align="center">
                                </el-table-column>
                                <el-table-column
                                        align="center"
                                        prop="productId.productName"
                                        label="产品名称"
                                        width="90">
                                </el-table-column>
                                <el-table-column
                                        align="center"
                                        label="产品规格"
                                        width="150">
                                    <template slot-scope="s">
                                        <span v-for="pro in s.row.qmodeldetails" :key="pro.prodetailId">
                                            {{pro.modetContent}}
                                        </span>
                                    </template>
                                </el-table-column>
                                <el-table-column
                                        align="center"
                                        prop="prodetaiJpri"
                                        label="进价"
                                        width="90">
                                </el-table-column>
                                <el-table-column
                                        align="center"
                                        label="售价"
                                        width="90">
                                    <template slot-scope="d">
                                        <span>{{d.row.prodetailSpri}}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column
                                        prop="busproNum"
                                        align="center"
                                        label="数量"
                                        width="150">
                                    <template slot-scope="d">
                                        <el-input-number @change="insidebuspro()" size="mini" :min="1" :max="10" v-model="d.row.busproNum"></el-input-number>
                                    </template>
                                </el-table-column>
                                <el-table-column
                                        align="center"
                                        prop="busproDeiscount"
                                        label="折扣（%）"
                                        width="90">
                                    <template slot-scope="d">
                                        <el-input @change="insidebuspro()"  oninput="if(value>100){value=100}else{value=value.replace(/[^\d]/g,'')}if(value.indexOf(0)==0){value=0}" size="mini" v-model="d.row.busproDeiscount" ></el-input>
                                    </template>
                                </el-table-column>
                                <el-table-column
                                        align="center"
                                        label="合计"
                                        width="90">
                                    <template slot-scope="d">
                                        <span>{{d.row.busproTotal}}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column
                                        label="操作"
                                        width="90">
                                    <template slot-scope="s">
                                        <!--如果是三个标签，后两个标签padding-left: 10px;-->
                                        <i @click="detpro(s.row)" style="font-size:18px;padding-left: 20px;color: #409EFF" class="el-icon-delete"></i>
                                    </template>
                                </el-table-column>
                            </el-table>
                        </div>
                    </div>
                    <!--下-->
                    <div style="margin-top: 20px;margin-left: 580px">
                        <span>产品合计：</span>
                        <span>{{aggregate}}</span>
                        <span>元</span>

                    </div>

                    <!--下-->
                    <div style="width: 170px;margin-top: 5px;margin-left: 560px;">
                        <el-button type="primary" @click="editpros">保存</el-button>
                        <el-button @click="displaybjcp" class="el-icon-back">返回</el-button>
                    </div>
                </el-scrollbar>
            </div>
        </el-dialog>
        <!--添加产品弹框-->
        <el-dialog width="800px" center :close-on-click-modal=false style="text-align: left" title="添加产品" :visible.sync="addprotankuan">
            <div style="height:430px;width: 740px" class="scrollbar">
                <el-scrollbar style="height:100%;width: 740px">
                    <!--上-->
                    <div style="height:50px;width: 730px">
                        <span>产品筛选：</span>
                        <el-input size="small" @blur="showaddprotab()"  @keyup.enter.native="showaddprotab()"  v-model="prosss" style="width: 160px"></el-input>
                        <el-button style="margin-left: 10px;height: 32px" size="mini" @click="showaddprotab()">搜索</el-button>
                    </div>
                    <div style="height: 40px">
                        <el-row>
                            <el-col :span="3">
                                <span>已选产品：</span>
                            </el-col>
                            <el-col :span="19" style="margin-top: -5px;;height: 40px;border: 0px solid">
                                <el-scrollbar style="height: 100%">
                                    <el-tag
                                            :key="tag.prodetailId"
                                            v-for="tag in multipleSelection">
                                        {{tag.productId.productName}}
                                        <span v-for="pro in tag.qmodeldetails" :key="pro.prodetailId">
                                            {{pro.modetContent}}
                                        </span>
                                    </el-tag>
                                </el-scrollbar>
                            </el-col>
                        </el-row>
                    </div>

                    <!--中-->
                    <div style="width: 730px;height: 280px">
                        <div style="width: 100%;height: 280px;float: left;">
                            <!--上表格-->
                            <div>
                                <el-table
                                        :data="producttab"
                                        ref="multipleSelection"
                                        @selection-change="handleSelectionChange"
                                        style="width: 100%"
                                        height="250">
                                    <el-table-column
                                            prop="prodetailId"
                                            type="selection"
                                            align="center">
                                    </el-table-column>
                                    <el-table-column
                                            prop="productId.productName"
                                            label="产品名称"
                                            align="center">
                                    </el-table-column>
                                    <el-table-column
                                            label="规格"
                                            align="center">
                                        <template slot-scope="s">
                                        <span v-for="pro in s.row.qmodeldetails" :key="pro.prodetailId">
                                            {{pro.modetContent}}
                                        </span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column
                                            prop="prodetaiJpri"
                                            label="进价（元）"
                                            align="center">
                                    </el-table-column>
                                    <el-table-column
                                            prop="prodetailSpri"
                                            label="售价（元）"
                                            align="center">
                                    </el-table-column>
                                </el-table>
                            </div>
                            <!--下分页-->
                            <div>
                                <div style="margin-left: 260px">
                                    <el-pagination
                                            @current-change="handleCurrentChange"
                                            layout="prev, pager, next"
                                            :current-page="currentPage"
                                            :page-size="pagesize"
                                            :total="pagetotal">
                                    </el-pagination>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!--下-->
                    <div style="width: 170px;margin-top: -60px;margin-left: 560px;">
                        <el-button type="primary" @click="addpros">保存</el-button>
                        <el-button  @click="displaytjcp" class="el-icon-back">返回</el-button>
                    </div>
                </el-scrollbar>
            </div>
        </el-dialog>
        <!--关联联系人界面-->
        <el-dialog width="800px" center :close-on-click-modal=false style="text-align: left" title="关联联系人" :visible.sync="addalr">
            <div style="height:430px;" class="scrollbar">
                <el-scrollbar style="height:100%">
                    <!--上-->
                    <div style="height:50px;width: 735px">
                        <span>联系人：</span>
                        <el-input size="small" v-model="linkmanposs" style="width: 160px"></el-input>
                        <el-button style="margin-left: 10px;height: 32px" size="mini" @click="linkmanlikeselect">搜索</el-button>
                    </div>
                    <!--中-->
                    <div style="border: 1px solid #EBEEF5;width: 735px;margin-top: -4px;height: 330px">
                        <!--右-->
                        <div style="width: 99%;margin: 0 auto">
                                <!--上表格-->
                                <el-table
                                        :data="alllinkmantable"
                                        style="width: 100%">
                                    <el-table-column width="55">
                                        <template slot-scope="scope">
                                            <el-radio v-model="radio" :label="scope.row.linkmanId"  @change="retainId(scope.row.linkmanId)">
                                                {{''}}
                                            </el-radio>
                                        </template>
                                    </el-table-column>
                                    <el-table-column
                                            prop="linkmanName"
                                            label="联系人名称"
                                            align="center"
                                            width="245">
                                    </el-table-column>
                                    <el-table-column
                                            label="职位"
                                            align="center"
                                            width="200"
                                            prop="linkmanPosition">
                                    </el-table-column>
                                    <el-table-column
                                            prop="linkmanMobile"
                                            label="电话"
                                            align="center"
                                            width="228">
                                    </el-table-column>
                                </el-table>
                            </div>
                    </div>
                    <!--下-->
                    <div style="width: 170px;margin-top: 5px;margin-left: 563px;">
                        <el-button type="primary" @click="editlinkman(businessform.busId)">保存</el-button>
                        <el-button  class="el-icon-back">返回</el-button>
                    </div>
                </el-scrollbar>
            </div>
        </el-dialog>
        <!--管理跟进快捷跟进模板-->
        <el-dialog width="800px" center :close-on-click-modal=false
                   style="text-align: left" title="快捷跟进设置" :visible.sync="isMoban">
            <div style="height:430px;" class="scrollbar">
                <div class="Administration">
                    <span style="color:#777;margin-left: 15px;">管理快捷跟进模板</span>
                    <el-button type="text" v-show="tjxsmb" icon="el-icon-plus" style="margin-left: 10px;" @click="addmb">添加</el-button>
                    <div class="moban" v-show="isMoMo">
                        <el-scrollbar style="height:350px;">
                            <div class="li" v-for="item in ttemplateoptions"
                                 :key="item.ttemplateId">
                                <p style="color: #8fa1b2;font-size:13px;">类型:{{item.type.typeName}}
                                    <span>
                                        <el-button type="text" icon="el-icon-edit" size="small" @click="Moban(item)"></el-button>
                                        <el-button type="text" icon="el-icon-delete" size="small" @click="mobandet(item.ttemplateId)"></el-button>
                                    </span>
                                </p>
                                <p style="font-size:14px;margin-top:-15px;">{{item.ttemplateNote}}</p>
                            </div>
                        </el-scrollbar>
                    </div>
                    <!--编辑快捷模版-->
                    <el-form style="margin-top: 20px" v-show="isSaveQuick">
                        <el-form-item style="margin-left:17px;" label="跟进类型:" >
                            <el-select v-model="ttemform.type" value-key="typeId" clearable placeholder="请选择">
                                <el-option
                                        v-for="item in typeoptions"
                                        :key="item.typeId"
                                        :label="item.typeName"
                                        :value="item">
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item style="margin-left:17px;" label="快捷内容:">
                            <el-input type="textarea" :rows="3" v-model="ttemform.ttemplateNote" placeholder="请输入内容" style="width:420px;">
                            </el-input>
                        </el-form-item>
                        <el-form-item style="position: absolute;margin-left:300px;margin-top: 204px">
                            <el-button type="primary" @click="mobanaddttem()">确定</el-button>
                            <el-button @click="backMo">取消</el-button>
                        </el-form-item>
                    </el-form>
                    <div class="moButton" v-show="isMoMo">
                        <el-button type="primary">确定</el-button>
                        <el-button @click="isMoban=false">取消</el-button>
                    </div>
                </div>
            </div>
        </el-dialog>
        <!--管理需求快捷跟进模板-->
        <el-dialog width="800px" center :close-on-click-modal=false
                   style="text-align: left" title="快捷需求设置" :visible.sync="isneed">
            <div style="height:430px;" class="scrollbar">
                <div class="Administration">
                    <span style="color:#777;margin-left: 15px;">管理快捷需求模板</span>
                    <el-button type="text" v-show="tjneed" icon="el-icon-plus" style="margin-left: 10px;" @click="addneed">添加</el-button>
                    <div class="moban" v-show="istemp">
                        <el-scrollbar style="height:350px;">
                            <div class="li" v-for="item in needoptions"
                                 :key="item.ntemplateId">
                                <span>
                                    <el-button type="text" icon="el-icon-edit" size="small" @click="need(item)"></el-button>
                                    <el-button type="text" icon="el-icon-delete" size="small" @click="needdet(item.ntemplateId)"></el-button>
                                </span>
                                <p style="font-size:14px;margin-top:-2px;">{{item.ntemplateNote}}</p>
                            </div>
                        </el-scrollbar>
                    </div>
                    <!--编辑快捷模版-->
                    <el-form style="margin-top: 20px" v-show="isaveneed">
                        <el-form-item style="margin-left:17px;" label="快捷内容:">
                            <el-input type="textarea" :rows="3" v-model="ntemplate.ntemplateNote" placeholder="请输入内容" style="width:420px;">
                            </el-input>
                        </el-form-item>
                        <el-form-item style="position: absolute;margin-left:300px;margin-top: 204px">
                            <el-button type="primary" @click="mobanaddntem()">确定</el-button>
                            <el-button @click="backneed">取消</el-button>
                        </el-form-item>
                    </el-form>
                    <div class="moButton" v-show="istemp">
                        <el-button type="primary">确定</el-button>
                        <el-button @click="isneed=false">取消</el-button>
                    </div>
                </div>
            </div>
        </el-dialog>
        <!--添加竞争对手公司弹框-->
        <el-dialog width="800px" center :before-close="viehandleDialogClose" :close-on-click-modal=false  style="text-align: left" title="添加对手" :visible.sync="busvieshow">
            <div style="height:430px;" class="scrollbar">
                <el-scrollbar style="height:100%">
                    <!--上-->
                    <div v-show="noshowaddive" style="height:50px;width: 735px">
                        <span style="color: #409EFF" class="apro" @click="showaddviestab">+添加竞争公司</span>
                        <span style="margin-left: 340px;">公司选择：</span>
                        <el-input size="small" @blur="showviestab()" v-model="viesposs" style="width: 160px"></el-input>
                        <el-button style="margin-left: 10px;height: 32px" size="mini" @click="showviestab()">搜索</el-button>
                    </div>
                    <!--中-->
                    <div v-show="noshowaddive" style="border: 1px solid #EBEEF5;width: 745px">
                        <div style="width: 99%;margin: 0 auto">
                            <el-table
                                    :data="vieList"
                                    style="width: 99%;margin-left: 10px;font-size:13px"
                                    height="275px"
                                    @selection-change="oneSelectionChange">
                                <el-table-column width="55">
                                    <template slot-scope="scope">
                                        <el-radio v-model="vieradio" :label="scope.row.vieId"  @change="retainvieId(scope.row)">
                                            {{''}}
                                        </el-radio>
                                    </template>
                                </el-table-column>
                                <el-table-column
                                        align="center"
                                        prop="vieName"
                                        label="公司名称">
                                </el-table-column>
                                <el-table-column
                                        prop="vvieStrategy"
                                        align="center"
                                        label="公司优势">
                                </el-table-column>
                                <el-table-column
                                        align="center"
                                        prop="vieInferior"
                                        label="公司劣势">
                                </el-table-column>
                                <el-table-column
                                        label="操作">
                                    <template slot-scope="s">
                                        <!--如果是三个标签，后两个标签padding-left: 10px;-->
                                        <i @click="eidtmyvies(s.row)" style="font-size:18px;padding-left: 20px;color: #409EFF" class="el-icon-edit"></i>
                                    </template>
                                </el-table-column>
                            </el-table>
                        </div>
                        <!--下分页-->
                        <div>
                            <div style="margin-left: 300px">
                                <el-pagination
                                        @current-change="viehandleCurrentChange"
                                        layout="prev, pager, next"
                                        :current-page="viescurrentPage"
                                        :page-size="viespagesize"
                                        :total="viepagetotal">
                                </el-pagination>
                            </div>
                        </div>
                    </div>

                    <div v-show="!noshowaddive" style="width: 745px;height:339px">
                        <span style="color:#777;margin-left: 15px;">管理竞争公司</span>
                        <el-form :model="myviesfrom" ref="myviesfrom" :rules="myviesrules" style="margin-top: 20px" v-show="!noshowaddive">
                            <el-form-item style="margin-left:17px;" prop="vieName" label="公司名称:" >
                                <el-input v-model="myviesfrom.vieName"  placeholder="请输入名称" style="width:215px;">
                                </el-input>
                            </el-form-item>
                            <el-form-item style="margin-left:17px;" prop="vvieStrategy" label="公司优势:">
                                <el-input type="textarea" :rows="3" v-model="myviesfrom.vvieStrategy" placeholder="请输入公司优势" style="width:420px;">
                                </el-input>
                            </el-form-item>
                            <el-form-item style="margin-left:17px;" prop="vieInferior" label="公司劣势:">
                                <el-input type="textarea" :rows="3" v-model="myviesfrom.vieInferior" placeholder="请输入公司劣势" style="width:420px;">
                                </el-input>
                            </el-form-item>
                        </el-form>
                    </div>
                    <!--下-->
                    <div v-show="noshowaddive" style="width: 170px;margin-top: 5px;margin-left: 560px;">
                        <el-button type="primary" @click="editpros">保存</el-button>
                        <el-button @click="displayvies" class="el-icon-back">返回</el-button>
                    </div>
                    <div v-show="!noshowaddive" style="width: 170px;margin-top: 5px;margin-left: 560px;">
                        <el-button type="primary" @click="myaddvies('myviesfrom')">保存</el-button>
                        <el-button @click="displayaddvies" class="el-icon-back">返回</el-button>
                    </div>
                </el-scrollbar>
            </div>
        </el-dialog>
        <!--添加竞争对手公司产品弹框-->
        <el-dialog width="800px" center :before-close="vieprohandleDialogClose" :close-on-click-modal=false style="text-align: left" title="添加竞争产品" :visible.sync="busvieproshow">
            <div style="height:430px;" class="scrollbar">
                <el-scrollbar style="height:100%">
                    <!--上-->
                    <div v-show="noshowaddviepro" style="height:50px;width: 735px">
                        <span style="color: #409EFF" class="apro" @click="showaddviesprotab">+添加竞争产品</span>
                        <span style="margin-left: 340px;">产品选择：</span>
                        <el-input size="small" v-model="viesproposs" @blur="showviesprotab()" style="width: 160px"></el-input>
                        <el-button style="margin-left: 10px;height: 32px" size="mini" @click="showviesprotab()">搜索</el-button>
                    </div>
                    <!--中-->
                    <div v-show="noshowaddviepro" style="border: 1px solid #EBEEF5;width: 745px">
                        <div style="width: 99%;margin: 0 auto">
                            <el-table
                                    :data="vieproList"
                                    ref="refvieList"
                                    style="width: 99%;margin-left: 10px;font-size:13px"
                                    height="280px"
                                    @selection-change="vieproSelectionChange">
                                <el-table-column
                                        prop="vproId"
                                        type="selection"
                                        align="center">
                                </el-table-column>
                                <el-table-column
                                        align="center"
                                        prop="vproName"
                                        label="产品名称">
                                </el-table-column>
                                <el-table-column
                                        prop="vproModel.vpmName"
                                        align="center"
                                        label="产品单位">
                                </el-table-column>
                                <el-table-column
                                        align="center"
                                        prop="vproPrice"
                                        label="产品价格">
                                </el-table-column>
                                <el-table-column
                                        label="操作">
                                    <template slot-scope="s">
                                        <!--如果是三个标签，后两个标签padding-left: 10px;-->
                                        <!--@click="detvie(s.row.vproId)" -->
                                        <i style="font-size:18px;padding-left: 20px;color: #409EFF" class="el-icon-delete"></i>
                                    </template>
                                </el-table-column>
                            </el-table>
                        </div>
                        <!--下分页-->
                        <div>
                            <div style="margin-left: 300px">
                                <el-pagination
                                        @current-change="vieprohandleCurrentChange"
                                        layout="prev, pager, next"
                                        :current-page="viesprocurrentPage"
                                        :page-size="viespropagesize"
                                        :total="viepropagetotal">
                                </el-pagination>
                            </div>
                        </div>
                    </div>
                    <div v-show="!noshowaddviepro" style="width: 745px;height:339px">
                        <span style="color:#777;margin-left: 15px;">管理竞争产品</span>
                        <el-form :model="vproform" ref="vproform" :rules="vproformrules" style="margin-top: 35px" v-show="!noshowaddviepro">
                            <el-row>
                                <el-col :span="12">
                                    <el-form-item style="margin-left:17px;" label="公司名称:" >
                                        <el-input v-model="viefrom.vie.vieName" disabled style="width:215px;">
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item style="margin-left:17px;" prop="vproName" label="产品名称:" >
                                        <el-input v-model="vproform.vproName" placeholder="请输入名称" style="width:215px;">
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="12">
                                    <el-form-item style="margin-left:17px;" label="产品价格:" >
                                        <el-input v-model="vproform.vproPrice" placeholder="请输入价格" style="width:215px;">
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item style="margin-left:17px;" prop="vproModel" label="产品规格:" >
                                        <el-select v-model="vproform.vproModel" style="width:215px;" value-key="vpmId" clearable placeholder="请选择">
                                            <el-option
                                                    v-for="item in viepromodelList"
                                                    :key="item.vpmId"
                                                    :label="item.vpmName"
                                                    :value="item">
                                            </el-option>
                                        </el-select>
                                        <i class="el-icon-setting" id="setting24" @click="isvieproshow=true"></i>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                        </el-form>
                    </div>
                    <!--下-->
                    <!--显示表格的-->
                    <div v-show="noshowaddviepro" style="width: 170px;margin-top: 5px;margin-left: 560px;">
                        <el-button type="primary" @click="editviepros">保存</el-button>
                        <el-button @click="dispkayviespro" class="el-icon-back">返回</el-button>
                    </div>
                    <!--添加产品的-->
                    <div v-show="!noshowaddviepro" style="width: 170px;margin-top: 5px;margin-left: 560px;">
                        <el-button type="primary" @click="addviepros('vproform')">保存</el-button>
                        <el-button @click="displayviepro" class="el-icon-back">返回</el-button>
                    </div>
                </el-scrollbar>
            </div>
        </el-dialog>
        <!--管理竞争产品规格快捷模板-->
        <el-dialog width="800px" center :close-on-click-modal=false
                   style="text-align: left" title="快捷规格设置" :visible.sync="isvieproshow">
            <div style="height:430px;" class="scrollbar">
                <div class="Administration">
                    <span style="color:#777;margin-left: 15px;">管理快捷规格模板</span>
                    <el-button type="text" v-show="onevieproshow" icon="el-icon-plus" style="margin-left: 10px;" @click="onevieproshow = !onevieproshow">添加</el-button>
                    <div class="moban" v-show="onevieproshow">
                        <el-scrollbar style="height:350px;">
                            <div class="li" v-for="item in viepromodelList"
                                 :key="item.vpmId">
                                <p style="color: #8fa1b2;font-size:13px;">规格名称：
                                    <!-- @click="Moban(item)"-->
                                    <!-- @click="mobandet(item.vpmId)"-->
                                    <span>
                                        <el-button type="text" icon="el-icon-edit" size="small"></el-button>
                                        <el-button type="text" icon="el-icon-delete" size="small"></el-button>
                                    </span>
                                </p>
                                <p style="font-size:14px;margin-top:-15px;">{{item.vpmName}}</p>
                            </div>
                        </el-scrollbar>
                    </div>
                    <!--编辑快捷模版-->
                    <el-form style="margin-top: 20px" :model="vpromodelfrom" v-show="!onevieproshow">

                        <el-form-item style="margin-left:17px;" label="规格名称:">
                            <el-input v-model="vpromodelfrom.vpmName" placeholder="请输入规格名称" style="width:215px;">
                            </el-input>
                        </el-form-item>
                        <el-form-item style="position: absolute;margin-left:300px;margin-top: 204px">
                            <el-button type="primary" @click="trueaddvpromodel()">确定</el-button>
                            <el-button @click="onevieproshow=!onevieproshow">取消</el-button>
                        </el-form-item>
                    </el-form>
                    <div class="moButton" v-show="onevieproshow">
                        <el-button type="primary" >确定</el-button>
                        <el-button @click="isvieproshow=false">取消</el-button>
                    </div>
                </div>
            </div>
        </el-dialog>

    </div>
</template>

<script>
    import {formatTimeToStr} from '../router//format.js'
    import Crypto  from '../router//secret.js'
    export default {
        name: "Busdetails",
        inject: ['reload'], // 引入方法
        data() {
            var yzschemetype = (rule, value, callback) => {
                if (value.name === '' || value.name===null) {
                    callback(new Error('请选择解决类型'));
                } else {
                    callback();
                }
            };
            var yzschemeDemand = (rule, value, callback) => {
                if (value.myid === 0 || value.myid===null) {
                    callback(new Error('请选择需求'));
                } else {
                    callback();
                }
            };

            return {

                myofferflag:false,//判断报价主题是否存在

                myschemeflag:false,//判断解决方案主题是否存在


                myviethemeflag:false,//判断竞争主题是否存在

                mybusno:'',
                myclientname:'',//暂时保存该商机编号与客户名称

                myneedflag:true,//判断客户需求主题是否存在

                myclientflag:false,//解决方案是否为修改

                linkmanposs:'',//联系人搜索按钮

                /*竞争产品规格表单*/
                vpromodelfrom:{
                    vpmId:0,
                    vpmName:''
                },

                isvieproshow:false,//显示快捷管理竞争产品规格模板
                onevieproshow:true,//显示规格列表/添加规格
                /*竞争产品表单*/
                vproform :{
                    vproId:0,
                    vproName:'',
                    vproPrice:0,
                    vproModel:{
                        vpmId:0,
                        vpmName:'',
                    },
                    vieId:0
                },

                viepromodelList:[],//竞争产品规格表
                noshowaddviepro:true,//显示竞争产品/竞争列表

                viesprocurrentPage:1,
                viespropagesize:5,
                viepropagetotal:0,//竞争产品分页

                viesproposs:'',//竞争产品模糊查询

                /*对手公司*/
                myviesfrom:{
                    vieId:0,
                    vieName:'',
                    vvieStrategy:'',
                    vieInferior:''
                },

                noshowaddive:true,//显示全部竞争公司/添加竞争公司

                viesposs:'',//查询公司
                viescurrentPage:1,
                viespagesize:5,
                viepagetotal:0,/*竞争公司分页数据*/

                vieprosid:'',//保存竞争产品ID

                viepros:'',//保存竞争产品名称

                refvieList:[],//存放竞争产品
                vieproList:[],//对手产品列表
                busvieproshow:false,//添加竞争对手公司产品弹框

                vieradio:'',//选择竞争公司
                
                vieList:[],//对手列表

                busvieshow:false,//添加竞争对手公司弹框

                ofshow:true,//报价客户已接受，报价按钮与产品编辑按钮不显示

                vieflag:true,//判断选择是那种类型
                schemeDemandoptions:[],//竞争对手解决类型对应下拉框
                nschemeDemandoptions:[],//客户需求解决类型对应下拉框
                /*解决类型下拉框*/
                schemeTypeoptions:[{
                    id:1,
                    name:'客户需求'
                },{
                    id:2,
                    name:'竞争对手'
                }],
                rules:{
                    'type.typeId': [
                        {type:'integer', required: true, message: '请选择跟进类型', trigger: 'blur' }
                    ],
                },//跟进进度表单验证

                needrules:{
                    'needTheme': [
                        { required: true, message: '请输入需求主题', trigger: 'blur' }
                    ],
                },//客户需求表单验证

                vierules:{
                    bvieName: [
                        { required: true, message: '请输入机会名称', trigger: 'blur' }
                    ],
                    'vie.vieName': [
                        { required: true, message: '请选择竞争公司', trigger: 'blur' }
                    ],
                    'bviePower': [
                        { required: true, message: '请选择竞争力', trigger: 'blur' }
                    ],

                },//竞争对手表单验证
                myviesrules:{
                    'vieName': [
                        { required: true, message: '请输入竞争公司名称', trigger: 'blur' }
                    ],
                    'vvieStrategy': [
                        { required: true, message: '请输入公司优势', trigger: 'blur' }
                    ],
                    vieInferior: [
                        { required: true, message: '请输入公司劣势', trigger: 'blur' }
                    ],

                },//竞争公司表单验证
                vproformrules:{
                    'vproName': [
                        { required: true, message: '请输入竞争产品名称', trigger: 'blur' }
                    ],
                    vproModel: [
                        { required: true, message: '请选择产品规格', trigger: 'change' }
                    ],

                },//竞争产品表单验证
                schemerule:{
                    schemeTheme: [
                        { required: true, message: '请输入解决方案主题', trigger: 'blur' }
                    ],
                    schemeType: [
                        { required: true, message: '请选择解决类型', trigger: 'change' },
                        {validator: yzschemetype}
                    ],
                    schemeDemand: [
                        { required: true, message: '请选择对应需求', trigger: 'change' },
                        {validator: yzschemeDemand}

                    ],
                    schemeRecord: [
                        { required: true, message: '请输入方案内容', trigger: 'change' }
                    ],

                },//解决方案表单验证

                offerrules:{
                    offerTheme: [
                        { required: true, message: '请输入报价主题', trigger: 'blur' }
                    ],
                    offerExamine: [
                        {type:'object',required: true, message: '请选择审批人', trigger: 'change' }
                    ]
                },//报价表单验证

                weiwei:false,

                /*判断报价客户是否接受*/
                offerflage:0,

                appofferOptions:[],//报价审批人

                /*设置标签页为禁用*/
                one:true,
                two:true,
                three:true,

                phaseoptions:[],//阶段

                /*分页数据*/
                pagesize:4,//页大小
                currentPage:1,//当前页
                pagetotal:0,//总页数


                outcount:0,//外层总计

                offerList:[],//报价表格

                offerfrom:{

                    offerId:0,
                    business:{
                        busId:0,
                        busNo:'',
                    },
                    offerTheme:'',//报价主题
                    offerNumbers:'',//报价单号
                    offerMoney:0,//报价金额
                    offerStatu:'',//报价状态
                    offerNote:'',//备注
                    offerPeople:'',//报价人
                    offerProfit:0,//报价毛利
                    offerTime:'',//报价时间
                    client:{
                        clientId:0,
                        clientName:'',
                    },//客户
                    busPrimarycontact: {
                        linkmanId:0,
                        linkmanName:'',
                    },/*客户联系人*/
                    offerList:[],//详情列表
                    offerExamine:{
                        empId:0,
                        empName:''
                    }

                },//报价表单

                multipleSelection:[],//添加产品复选框

                multipleTable:[],//编辑产品复选框


                proList:[],//编辑产品列表

                dbuspros:[],//产品外列表

                prosize:0,//监听购物车产品数量

                cclinkmanId:'',//保存选中的联系人ID

                aggregate:'',//总计

                radio:'',//单选按钮

                alllinkmantable:[],//该客户所有联系人表格

                linkmantables:[],//绑定联系人表格

                offershow:false,//显示添加报价框

                schemeshow:false,//显示添加解决方案

                vieshow:false,//显示添加对手框

                schemefrom:{
                    schemeId:0,
                    busId:{
                        busId:'',
                        busNo:'',
                    },
                    schemeTheme:'',
                    schemeNowtime:'',
                    schemeRecord:'',
                    schemeFeedback:'',
                    schemePeople:'',
                    schemeType:'',
                    schemeDemand:null,
                },//解决方案表单

                schemelist:[],//解决方案列表

                busvie:{

                    bvieId:0,

                },

                viecompanyfrom:{
                    vieId:0,
                    vieName:'',
                    vieMoney:'',
                    vieStrategy:'',
                    vieInferior:''
                },//竞争公司信息

                viefrom:{
                    bvieId:0,
                    bus:0,
                    bvieMoney:0,
                    bviePower:'',
                    bviePeople:'',
                    vie:{
                        vieStrategy:'',
                        vieId:0,
                        vieInferior:'',
                        vieMoney:'',
                        vieName:'',
                    }
                },
                myviepros:[],//竞争对手的产品

                busvielist:[],//该商机对手公司列表

                ntemplate:{
                    ntemplateId:'',
                    ntemplateNote:'',
                },//客户需求模板

                needoptions:[],//客户需求模板下拉框

                needfrom:{
                    needTheme:'',//需求主题
                    needNote:'',//需求内容
                    ntemplateId:{
                        ntemplateId:'',//需求模板ID
                        ntemplateNote:'',//需求模板内容
                    },
                    needPeople:'',//提供人
                    busId:'',
                    needNowtime:'',//时间
                },//客户需求表单

                bustails:{
                    tailRecord:'',//跟进内容
                    type:{
                        typeId:'',
                        typeName:'',
                    },//跟进类型ID
                    tailNexttime:'',//下次联系时间
                    ttemplateId:{
                        ttemplateId:'',
                        ttemplateNote:'',
                    },//跟进模板ID
                    clientId:'',//客户ID
                    linkmanId:'',//联系人ID
                    busId:{
                        busId:''
                    },//商机ID
                },//跟进记录表单

                typeoptions:[],//存放跟进类型内容

                ttemplateoptions:[],//存放跟进模板内容

                tailslist:[],//存放查询所有跟进记录

                needlist:[],//存放查询所有需求记录

                ttemform:{
                    ttemplateId:'',
                    ttemplateNote:'',
                    type:{
                        typeId:'',
                        typeName:'',
                    }
                },//模板表单



                isneed:false,//管理客户需求快捷添加模板
                checked2:false,//客户需求保存为快捷模板
                tjneed:true,//需求模板添加按钮显示
                istemp:true,//客户需求模板列表
                isaveneed:false,//编辑客户需求快捷模板

                isMoban:false,//管理跟进记录快捷添加模板
                checked:false,//跟进记录保存为快捷模板
                tjxsmb:true,//跟进记录添加按钮显示
                isMoMo:true,//跟进记录模版列表
                isSaveQuick:false,//编辑跟进记录快捷模板


                /*对齐方式*/
                labelPosition:'left',
                /*保存传过来的row*/
                businessform:{
                    /*商机基本信息数据*/
                    busId:0,/*商机编号*/
                    busName: '',/*商机名称*/
                    busSettime:'',/*商机建立时间*/
                    client: {
                        /*客户名称*/
                        clientId:0,
                        clientName:'',
                    },
                    busPrimarycontact: {
                        linkmanId:0,
                        linkmanName:'',
                    },/*客户联系人*/
                    busPeople: '',/*负责人*/
                    busNo:'',/*商机编号*/
                    /*预期数据*/
                    busWritten:'',/*预期签单日期*/
                    busPossibility:'',/*可能行*/
                    busMoney:0,/*预期金额*/
                    /*阶段*/
                    phase:{
                        phaseId:0,
                        phaseName:'',
                    },
                },
                /*表单向右数据*/
                formright:'right',

                /*产品搜索*/
                prosss:'',

                /*记录编辑产品弹框*/
                jilutankuan:false,
                /*记录添加产品弹框*/
                addprotankuan:false,
                /*记录关联联系人弹框*/
                addalr:false,
                /*产品信息*/
                producttab:[],
                /*是否显示客户需求记录*/
                projl:false,
                /*是否显示跟踪记录div*/
                jl:false,
                activeName2: 'first',

            };
        },

        methods: {

            selectttembytypeId(value){
                this.print(value);
                var a = value.typeId;
                this.$axios.post("http://localhost:8088/business/tail/selectttembytypeId",this.qs.stringify(
                    {typeId:a}
                )).then((v)=>{
                    this.ttemplateoptions = v.data;
                }).catch(()=>{

                });
            },


            /*收起解决方案框*/
            canceladdscheme(){

                this.schemefrom={
                    schemeId:0,
                    schemeTheme:'',
                    schemeRecord:'',
                    schemeFeedback:'',
                }
                this.schemeshow=false;
                this.myclientflag=false;

            },
            /*收起竞争机会*/
            canceladdvie(){
                this.vieradio='';//清除竞争公司名称
                this.viefrom={
                    bvieId:0,
                    bus:0,
                    bvieMoney:0,
                    bviePower:'',
                    bviePeople:'',
                    vie:{
                        vieStrategy:'',
                        vieId:0,
                        vieInferior:'',
                        vieMoney:'',
                        vieName:'',
                    }
                };//添加对手机会表单
                if(this.myviepros.length>0){
                    this.$refs.refvieList.clearSelection();//清除竞争公司产品
                }
                /*初始化产品*/
                this.vieprosid='';
                this.viepros='';
                this.myviepros=[];
                this.vieshow=false;

            },

            /*收起客户需求*/
            canceladdneeds(){
                this.projl=false;
                this.checked2=false;
                this.needfrom={
                    needTheme:'',//需求主题
                    needNote:'',//需求内容
                    ntemplateId:{
                        ntemplateId:'',//需求模板ID
                        ntemplateNote:'',//需求模板内容
                    },
                    needPeople:'',//提供人
                    busId:this.businessform.busId,
                    needNowtime:'',//时间
                };//客户需求表单

            },

            /*收起跟进记录框*/
            canceladdtails(){
                this.checked=false;
                this.bustails={
                    tailRecord:'',//跟进内容
                    type:{
                        typeId:'',
                        typeName:'',
                    },//跟进类型ID
                    tailNexttime:'',//下次联系时间
                    ttemplateId:{
                        ttemplateId:'',
                        ttemplateNote:'',
                    },//跟进模板ID
                    clientId:this.businessform.client.clientId,//客户ID
                    linkmanId:this.businessform.busPrimarycontact.linkmanId,//联系人ID
                    busId:{
                        busId:this.businessform.busId
                    },//商机ID
                };//跟进记录表单
                this.jl=false;
            },

            /*验证输入的预期金额*/
            checkInput() {
                this.viefrom.bvieMoney = this.dealInputVal(this.viefrom.bvieMoney);
            },
            dealInputVal(value) {
                value = value.replace(/^0*(0\.|[1-9])/, "$1");
                value = value.replace(/[^\d.]/g, ""); //清除"数字"和"."以外的字符
                value = value.replace(/^\./g, ""); //验证第一个字符是数字而不是字符
                value = value.replace(/\.{1,}/g, "."); //只保留第一个.清除多余的
                value = value
                    .replace(".", "$#$")
                    .replace(/\./g, "")
                    .replace("$#$", ".");
                /* value = value.replace(/^(\-)*(\d*)\.(\d\d).*$/, "$1$2.$3"); //只能输入两个小数*/
                value =
                    value.indexOf(".") > 0
                        ? value.split(".")[0].substring(0, 10) + "." + value.split(".")[1]
                        : value.substring(0, 10);
                return value;
            },

            /*该客户联系人模糊查询*/
            linkmanlikeselect(){
                this.viewdata(this.businessform.client.clientId);
            },

            /*新增竞争产品规格*/
            trueaddvpromodel(){
                this.$axios.post("http://localhost:8088/business/vie/trueaddvpromodel",this.vpromodelfrom).then(()=>{
                    if(this.vpromodelfrom.vpmId!=0){
                        this.$message({
                            type: 'success',
                            message: '修改成功!'
                        });

                    }else{
                        this.$message({
                            type: 'success',
                            message: '新增成功!'
                        });
                    }
                    this.vpromodelfrom={
                        vpmId:0,
                        vpmName:''
                    },
                        this.selectmodel();
                    this.onevieproshow = !this.onevieproshow;
                }).catch(()=>{
                    this.$message({
                        type: 'success',
                        message: '系统繁忙!'
                    });
                });
            },

            /*确认添加竞争产品*/
            addviepros(a){
                this.$refs[a].validate(valid => {
                    if (valid) {
                        this.tureaddviepros();
                    }else{
                        return false;
                    }

                });
            },
            tureaddviepros(){
                this.vproform.vieId = this.viefrom.vie.vieId;
                this.$axios.post("http://localhost:8088/business/vie/addviepro",this.vproform).then(()=>{
                    if(this.vproform.vproId!=0){
                        this.$message({
                            type: 'success',
                            message: '修改成功!'
                        });

                    }else{
                        this.$message({
                            type: 'success',
                            message: '新增成功!'
                        });
                    }
                    this.vproform ={
                        vproId:0,
                        vproName:'',
                        vproPrice:0,
                        vproModel:{
                            vpmId:0,
                            vpmName:'',
                        },
                        vieId:0
                    },
                        this.selectallviepro();
                    this.noshowaddviepro = !this.noshowaddviepro;
                }).catch(()=>{
                    this.$message({
                        type: 'success',
                        message: '系统繁忙!'
                    });
                });
            },

            /*查询所有规格型号*/
            selectmodel(){
                this.$axios.post("http://localhost:8088/business/vie/selectmodel").then((v)=>{
                    this.viepromodelList = v.data;
                }).catch(()=>{

                });
            },
            /*关闭竞争产品添加框，显示列表*/
            displayviepro(){
                this.noshowaddviepro = !this.noshowaddviepro;
            },

            /*搜索竞争产品方法*/
            showviesprotab(){
                this.selectallviepro();
            },

            /*显示添加竞争产品*/
            showaddviesprotab(){
                this.noshowaddviepro = !this.noshowaddviepro;
            },

            /*竞争产品当前页方法*/
            vieprohandleCurrentChange(val){
                this.viesprocurrentPage = val;
                this.selectallviepro();
            },

            /*修改竞争公司新增*/
            eidtmyvies(row){
                this.myviesfrom=row;
                this.noshowaddive = !this.noshowaddive;

            },

            /*添加竞争公司*/
            myaddvies(viod){
                this.$refs[viod].validate(valid => {
                    if (valid) {
                        this.trueaddmyvids();
                    }else{
                        return false;
                    }
                });

            },
            trueaddmyvids(){
                this.$axios.post("http://localhost:8088/business/vie/addmyvies",this.myviesfrom).then(()=>{
                    if(this.myviesfrom.vieId!=0){
                        this.$message({
                            type: 'success',
                            message: '修改成功!'
                        });

                    }else{
                        this.$message({
                            type: 'success',
                            message: '新增成功!'
                        });
                    }
                    this.myviesfrom={
                        vieId:0,
                        vieName:'',
                        vvieStrategy:'',
                        vieInferior:''
                    }, this.selectbusvies();
                    this.noshowaddive = !this.noshowaddive;
                }).catch(()=>{
                    this.$message({
                        type: 'success',
                        message: '系统繁忙!'
                    });
                });
            },

            /*返回全部竞争对手框*/
            displayaddvies(){
                this.noshowaddive = !this.noshowaddive;
            },

            /*显示添加竞争对手框*/
            showaddviestab(){
                this.noshowaddive = !this.noshowaddive;
            },

            /*关闭竞争产品弹框*/
            vieprohandleDialogClose(){
                this.dispkayviespro();
            },

            dispkayviespro(){
                this.busvieproshow=false;
                this.noshowaddviepro=true;
                this.viesproposs='';
                this.$refs.refvieList.clearSelection();//清除竞争公司产品
            },


            /*关闭竞争公司弹框*/
            viehandleDialogClose(){
                this.displayvies();
            },

            /*关闭竞争公司弹框*/
            displayvies(){
                this.busvieshow=false;
                this.noshowaddive=true;
                this.viesposs='';//查询公司
                this.vieradio='';//选择竞争公司
            },

            /*模糊查询竞争公司*/
            showviestab(){
                this.selectbusvies();
            },

            /*竞争对手公司当前页方法*/
            viehandleCurrentChange(val){
                this.viescurrentPage=val;
                this.selectbusvies();
            },

            /*保存选择竞争产品*/
            editviepros(){
                this.$refs.refvieList.selection.forEach((pro,i)=>{
                    this.print(pro);
                    var apro={
                        bvpId:0,
                        bvieId:0,
                        vpros:{
                            vproId:0,
                            vproName:'',
                            vproPrice:''
                        }
                    };//暂时代替竞争产品对象
                    apro.vpros=pro;
                    this.myviepros.splice(i,0,apro);
                    this.viepros=this.viepros+pro.vproName+"/";
                })
                this.print(this.viefrom);
                let index  = this.viepros.lastIndexOf("/")
                this.viepros =this.viepros.substring(0,index);
                this.busvieproshow=false;
            },
            /*保存选中的竞争产品*/
            vieproSelectionChange(val){
                this.refvieList=val;
            },

            /*显示竞争产品弹框*/
            showviepros(){
                this.selectmodel();
                this.busvieproshow=true;

            },

            /*选中竞争公司*/
            retainvieId(vie){
                this.busvieshow=false;
                this.viefrom.vie.vieName = vie.vieName;
                this.viefrom.vie.vieId = vie.vieId;
                this.selectallviepro();
            },
            /*查询该竞争公司的所有产品*/
            selectallviepro(){
                this.$axios.post("http://localhost:8088/business/vie/selectallviepro",this.qs.stringify(
                    {vieId:this.viefrom.vie.vieId,
                        currentpage:this.viesprocurrentPage,pagesize:this.viespropagesize,
                        vproName:this.viesproposs}
                )).then((v)=>{
                        this.vieproList = v.data.rows;
                        this.viepropagetotal=v.data.total;
                }).catch(()=>{

                });
            },
            //查询所有竞争公司
            selectbusvies() {
                this.$axios.post("http://localhost:8088/business/vie/selectallvie",this.qs.stringify(
                    {currentpage:this.viescurrentPage,pagesize:this.viespagesize,
                        vieName:this.viesposs}
                )).then((v)=>{
                        this.vieList = v.data.rows;
                        this.viepagetotal = v.data.total;
                }).catch(()=>{
                });


            },


            /*弹出对手框*/
            showvies(){
                this.busvieshow=true;
            },

            /*选择对应的解决类型时*/
            changedemand(){
                var a = this.businessform.busId;
                this.$axios.post("http://localhost:8088/business/scheme/selectBytype",this.qs.stringify(
                    {type:this.schemefrom.schemeType,busId:parseInt(a)}
                ))
                    .then((v)=>{
                        this.schemeDemandoptions = v.data;
                    }).catch(()=>{
                });
            },

            /*关闭编辑产品弹框*/
            displaybjcp(){
                this.jilutankuan=false;
            },
            /*关闭添加产品弹框*/
            displaytjcp(){
                this.addprotankuan=false;
            },
            /*编辑商机方法*/
            editbus(busId){
                busId = escape(Crypto.set(busId)); // 加密数据
                this.$router.push({
                    path: "/addbusniess",
                    query:{
                        busId:busId,
                    }
                });
            },
            /*跳转报价详情方法*/
            todetails(row){

                var offerId = row.offerId;
                var busId = row.business.busId;

                busId = escape(Crypto.set(busId)); // 加密数据
                offerId = escape(Crypto.set(offerId)); // 加密数据
                this.$router.push({
                    path:'/offerdetails',
                    query: {
                        offerId:offerId,
                        busId:busId
                    }

                })
            },

            /*查询此商机的跟进记录*/
            selectalltails(a){
                //查询该商机的跟进记录
                this.$axios.post("http://localhost:8088/business/tail/selectAllTails",this.qs.stringify(
                    {busId:parseInt(a)}
                ))
                    .then((v)=>{
                        this.tailslist = v.data;

                    }).catch(()=>{
                });
            },

            /*查询此商机的客户需求*/
            selectAllnned(a){
                //查询此商机的客户需求
                this.$axios.post("http://localhost:8088/business/need/selectAllnned",this.qs.stringify(
                    {busId:parseInt(a)}
                ))
                    .then((v)=>{
                        this.needlist = v.data;

                    }).catch(()=>{
                });

            },

            /*初始化商机数据方法*/
            init(){
                var a = Crypto.get(unescape(this.$route.query.row));
                this.$axios.post("http://localhost:8088/business/selectBybusId",this.qs.stringify(
                    {busId:parseInt(a)}
                    ))
                    .then((v)=>{
                        this.businessform = v.data;
                        //赋值客户，联系人，商机ID
                        this.bustails.busId.busId=this.businessform.busId
                        this.bustails.clientId = this.businessform.client.clientId
                        this.bustails.linkmanId = this.businessform.busPrimarycontact.linkmanId;
                        this.selectalltails(a);//查询该商机所有跟进记录
                        this.editprodata(parseInt(a));//查询该商机所有产品
                        this.selectAllnned(parseInt(a));//查询该商机所有客户需求
                        this.selectvie(parseInt(a));//查询该商机所有竞争对手
                        this.selectscheme(parseInt(a));//查询该商机所有解决方案
                        this.selectOfferBybusId(parseInt(a));//查询该商机的报价记录
                        this.inphase();//查询所有进度
                        this.selectbusvies();//查询所有竞争公司
                        if(v.data.phase.phaseId==2){
                            this.one=false;
                        }
                        if(v.data.phase.phaseId>=3 ){
                            this.one=false;
                            this.two=false;
                            this.three=false;
                        }

                    }).catch(()=>{
                });


            },

            /*添加跟踪记录*/
            addtails(a){
                if(this.bustails.tailRecord!=''){
                    this.$refs[a].validate((valid) => {
                        if (valid) {
                            this.$axios.post("http://localhost:8088/business/tail/addbustail",this.bustails)
                                .then(()=>{
                                    if(this.checked){
                                        this.ttemform.ttemplateNote = this.bustails.tailRecord;
                                        this.ttemform.type = this.bustails.type;
                                        this.addttem();
                                    }
                                    this.selectalltails(this.bustails.busId.busId);
                                    this.$message({
                                        type: 'success',
                                        message: '新增成功!'
                                    });

                                    this.init();
                                    this.checked=false;
                                    this.bustails={
                                        tailRecord:'',//跟进内容
                                        type:{
                                            typeId:'',
                                            typeName:'',
                                        },//跟进类型ID
                                        tailNexttime:'',//下次联系时间
                                        ttemplateId:{
                                            ttemplateId:'',
                                            ttemplateNote:'',
                                        },//跟进模板ID
                                        clientId:this.businessform.client.clientId,//客户ID
                                        linkmanId:this.businessform.busPrimarycontact.linkmanId,//联系人ID
                                        busId:{
                                            busId:this.businessform.busId
                                        },//商机ID
                                    };//跟进记录表单

                                    this.jl=false;
                                }).catch(()=>{
                            });
                        } else {
                            return false;
                        }
                    });
                }
                else{
                    this.$message({
                        showClose: true,
                        message: '请输入跟进记录',
                        type: 'warning'
                    });
                }
            },

            /*新增和修改跟进记录模板内容方法*/
            addttem(){
                this.$axios.post("http://localhost:8088/business/tail/addttem",this.ttemform)
                    .then(()=>{
                        this.selectttemplate();
                    }).catch(()=>{
                })
            },

            /*新增和修改跟进记录模板内容方法*/
            mobanaddttem(){
                this.addttem();
                if(this.ttemform.ttemplateId==0){
                    this.$message({
                        type: 'success',
                        message: '新增成功!'
                    });
                }
                if(this.ttemform.ttemplateId!=0){
                    this.$message({
                        type: 'success',
                        message: '修改成功!'
                    });
                }

                this.isMoMo=true;
                this.isSaveQuick=false;
                this.tjxsmb=true;
                this.ttemform={
                    ttemplateId:'',
                    ttemplateNote:'',
                    type:{
                        typeId:'',
                        typeName:'',
                    }
                };//模板表单
            },


            /*显示跟踪需求记录框*/
            showjl(){
                this.jl=true;
                this.selectttemplate();
                //查询跟进类型
                this.$axios.post("http://localhost:8088/business/tail/selectalltype")
                    .then((v)=>{
                        this.typeoptions = v.data;

                    }).catch(()=>{
                });

            },

            //查询跟进模板
            selectttemplate(){
                this.$axios.post("http://localhost:8088/business/tail/selectttemplate")
                    .then((v)=>{
                        this.ttemplateoptions = v.data;

                    }).catch(()=>{
                });
            },

            /*修改跟进记录模板内容*/
            Moban(a){
                this.ttemform.ttemplateNote=a.ttemplateNote;
                this.ttemform.ttemplateId=a.ttemplateId;
                this.typeoptions.forEach(v=>{
                    if(v.typeId == a.type.typeId){
                        this.ttemform.type=v;
                    }
                })

                this.isMoMo=false;
                this.isSaveQuick=true;
                this.tjxsmb=false;
            },

            /*添加跟进记录模板内容*/
            addmb(){
                this.isMoMo=false;
                this.isSaveQuick=true;
                this.tjxsmb=false;
            },

            /*新增和修改客户需求模板内容方法*/
            addntem(){
                this.$axios.post("http://localhost:8088/business/need/addntem",this.ntemplate)
                    .then(()=>{
                        this.selectAllnt();
                    }).catch(()=>{

                })
            },

            /*新增和修改客户需求模板内容方法*/
            mobanaddntem(){
                this.addntem();

                if(this.ntemplate.ntemplateId==0){
                    this.$message({
                        type: 'success',
                        message: '新增成功!'
                    });
                }
                if(this.ntemplate.ntemplateId!=0){
                    this.$message({
                        type: 'success',
                        message: '修改成功!'
                    });
                }
                this.backneed();
                this.ntemplate={
                    ntemplateId:'',
                    ntemplateNote:'',
                }
            },


            /*添加客户需求模板内容*/
            addneed(){
                this.ntemplate.ntemplateNote="";
                this.istemp=false;
                this.isaveneed=true;
                this.tjneed=false;

            },
            /*修改客户需求模板内容*/
            need(a){
                this.ntemplate.ntemplateNote=a.ntemplateNote;
                this.ntemplate.ntemplateId=a.ntemplateId;
                this.istemp=false;
                this.isaveneed=true;
                this.tjneed=false;
            },

            /*返回客户需求模板列表*/
            backneed(){
                this.istemp=true;
                this.isaveneed=false;
                this.tjneed=true;
            },
            /*返回跟进记录模板列表*/
            backMo(){
                this.isMoMo=true;
                this.isSaveQuick=false;
                this.tjxsmb=true;
            },
            //跟进模板与类型相关联
            changenote(){
                this.bustails.tailRecord = this.bustails.ttemplateId.ttemplateNote;
                this.typeoptions.forEach(v=>{
                    if(v.typeId == this.bustails.ttemplateId.type.typeId){
                        this.bustails.typeId=v;
                    }
                })
            },

            /*当跟进记录改变时，选择的需求模板情空*/
            ctails(){
                this.bustails.ttemplateId={
                    ttemplateId:'',
                    ttemplateNote:'',
                }
            },

            /*新增客户需求*/
            addneeds(a){
                this.needfrom.busId=this.businessform.busId;
                if(this.needfrom.needNote!=''){
                    this.$refs[a].validate((valid) => {
                        if(valid){
                            this.verifyneedtheme();
                        }else {
                            return false;
                        }
                    })

                }else{
                    this.$message({
                        showClose: true,
                        message: '请输入需求内容',
                        type: 'warning'
                    });
                }
            },

            /*验证需求名称是否和以前相同*/
            verifyneedtheme(){
                this.$axios.post("http://localhost:8088/business/need/selectByneedtheme",
                    this.qs.stringify({
                        needTheme:this.needfrom.needTheme
                    })).then(v=> {
                        if(v.data==1){
                            this.$message({
                                showClose: true,
                                message: '该需求主题已存在',
                                type: 'warning'
                            });
                        }else{
                            this.needaddmeonth();
                            this.projl=false;
                        }
                    }).catch(()=>{

                })
            },

            needaddmeonth(){
                this.$axios.post("http://localhost:8088/business/need/addneed",this.needfrom)
                    .then(()=>{
                        if(this.checked2){
                            this.ntemplate.ntemplateNote = this.needfrom.needNote
                            this.addntem();
                        }

                        this.$message({
                            type: 'success',
                            message: '新增成功!'
                        });
                        this.checked2=false;
                        this.needfrom={
                            needTheme:'',//需求主题
                            needNote:'',//需求内容
                            ntemplateId:{
                                ntemplateId:'',//需求模板ID
                                ntemplateNote:'',//需求模板内容
                            },
                            needPeople:'',//提供人
                            busId:this.businessform.busId,
                            needNowtime:'',//时间
                        };//客户需求表单

                        this.buspeople();
                        this.getNowTime();
                        this.selectAllnned(this.needfrom.busId);
                    }).catch(()=>{
                });
            },

            //删除跟进记录模板
            mobandet(v){
                this.$axios.post("http://localhost:8088/business/tail/detttem",
                this.qs.stringify({
                    ttemplateId:v
                })).then(()=>{
                    this.selectttemplate();
                    this.$message({
                        type: 'success',
                        message: '删除成功!'
                    });
                }).catch(()=>{
                });
            },

            //删除客户需求模板
            needdet(v){
                this.$axios.post("http://localhost:8088/business/need/detntem",
                    this.qs.stringify({
                        ntemplateId:v
                    })).then(()=>{
                    this.selectAllnt();
                    this.$message({
                        type: 'success',
                        message: '删除成功!'
                    });
                }).catch(()=>{
                });
            },



            /*显示客户需求记录框*/
            showprojl(){
                this.projl=true;
                this.buspeople();
                this.getNowTime();

                this.selectAllnt();
            },

            /*商机负责人*/
            buspeople(){

                var a = this.businessform.busPeople;

                /*赋值*/
                this.needfrom.needPeople = a;
                this.schemefrom.schemePeople=a;
                this.offerfrom.offerPeople=a;
            },


            /*查询客户需求模板*/
            selectAllnt(){
                this.$axios.post("http://localhost:8088/business/need/selectAllnt")
                    .then((v)=>{
                        this.needoptions = v.data;
                    }).catch(()=>{
                });
            },

            /*客户模板和客户需求关联*/
            changeneed(){
                this.needfrom.needNote=this.needfrom.ntemplateId.ntemplateNote;
            },
            /*当客户需求改变时，选择的需求模板情空*/
            cnote(){
                this.needfrom.ntemplateId={
                    ntemplateId:'',
                    ntemplateNote:'',
                }
            },

            /*显示添加对手框*/
            vieShows(){
                this.vieshow=true;
            },
            /*查询该商机竞争对手*/
            selectvie(a){
                this.$axios.post("http://localhost:8088/business/vie/selectvie",this.qs.stringify(
                    {busId:parseInt(a)}
                )).then((v)=>{
                    if(v.data!=null) {
                        this.mybusno = this.businessform.busNo;
                        this.myclientname = this.businessform.client.clientName;
                        this.busvielist = v.data;
                    }else{
                        this.mybusno='';
                        this.myclientname='';
                    }
                });
            },

            /*添加对手*/
            addvie(viod){
                this.print(this.viefrom);
                this.$refs[viod].validate((valid) => {
                    if(valid){
                        if(this.viepros!=''){
                            this.myviestheme();

                        }else{
                            this.$message({
                                showClose: true,
                                message: '请选择竞争产品',
                                type: 'warning'
                            });
                        }
                    }else {
                        return false;
                    }
                })


            },
            /*添加竞争机会*/
            myvidmethed(){
                this.viefrom.bus = this.businessform.busId;
                var a = this.viefrom.bviePower
                if(a==1){
                    this.viefrom.bviePower='弱项竞争'
                }
                if(a==2){
                    this.viefrom.bviePower='一般竞争'
                }
                if(a==3){
                    this.viefrom.bviePower='强项竞争'
                }

                this.addbusvies();

                this.vieradio='';//清除竞争公司名称
                this.$refs.refvieList.clearSelection();//清除竞争公司产品
            },


            /*验证竞争对手机会主题是否存在*/
            myviestheme(){
                this.$axios.post("http://localhost:8088/business/vie/selectBybvieName",
                    this.qs.stringify({bvieName:this.viefrom.bvieName})).then(v=>{
                        if(v.data==1){
                            this.$message({
                                showClose: true,
                                message: '该主题已存在',
                                type: 'warning'
                            });
                        }else{
                            this.myvidmethed();
                        }
                    }).catch(()=>{

                })
            },

            /*添加对手竞争机会*/
            addbusvies(){
                this.viefrom.bviePeople = this.businessform.busPeople;
                var viefrom=JSON.stringify({viefrom:this.viefrom,viepros:this.myviepros})
                this.$axios.post("http://localhost:8088/business/vie/addvie",this.qs.stringify({viefrom:viefrom})).then(()=>{
                    this.selectvie(this.businessform.busId);
                    this.viefrom={
                        bvieId:0,
                        bus:0,
                        bvieMoney:0,
                        bviePower:'',
                        bviePeople:'',
                        vie:{
                            vieStrategy:'',
                            vieId:0,
                            vieInferior:'',
                            vieMoney:'',
                            vieName:'',
                        }
                    };//添加对手机会表单
                    /*初始化产品*/
                    this.vieprosid='';
                    this.viepros='';
                    this.myviepros=[];
                    this.vieshow=false;
                    this.$message({
                        type: 'success',
                        message: '新增成功!'
                    });
                });

            },

            /*删除对手*/
            detvie(bvieId){
                this.$axios.post("http://localhost:8088/business/vie/detvie",this.qs.stringify(
                    {bvieId:parseInt(bvieId)}
                )).then(()=>{
                    this.$message({
                        showClose: true,
                        message: '删除成功！',
                        type: 'success'
                    });
                    this.selectvie(this.businessform.busId);
                    this.buspeople();
                });

            },

            /*显示添加解决方案框*/
            schemeShows(){
                if( this.$refs.schemefrom!=undefined){
                    this.$refs.schemefrom.resetFields();
                }
                this.schemeshow=true;

            },

            /*查询解决方案*/
            selectscheme(a){
                this.$axios.post("http://localhost:8088/business/scheme/selectscheme",this.qs.stringify(
                    {busId:parseInt(a)}
                )).then((v)=>{
                    this.schemelist = v.data;
                    this.schemelist.forEach(v=>{
                        if(v.schemeType=='客户需求'){
                            this.$axios.post("http://localhost:8088/business/need/selectById",this.qs.stringify(
                                {needId:parseInt(v.schemeDemand)}
                            )).then((k)=>{
                                this.$set(v,'needTheme',k.data.needTheme)
                            });
                        }else{
                            this.$axios.post("http://localhost:8088/business/vie/selectById",this.qs.stringify(
                                {bvieId:parseInt(v.schemeDemand)}
                            )).then((j)=>{
                                this.$set(v,'bvieName',j.data.bvieName)
                            });
                        }
                    })
                });
            },



            /*显示报价框*/
            offerShows(){
                this.offershow=true;
                this.buspeople();
            },

            /*添加报价按钮*/
            addoffer(viod){
                this.$refs[viod].validate((valid) => {
                    if(valid){
                        this.verifymyoffersheme();
                        if(!this.myofferflag){
                            this.myaddshemes();
                        }
                    }else {
                        return false;
                    }
                })


            },

            /*验证报价主题是否存在*/
            verifymyoffersheme(){
                this.$axios.post("http://localhost:8088/offer/verifymyoffersheme",this.qs.stringify(
                    {offerTheme:this.offerfrom.offerTheme}
                )).then(v=>{
                    if(v.data){
                        this.myofferflag=true;
                        this.$message({
                            showClose: true,
                            message: '该主题已存在',
                            type: 'warning'
                        });
                    }
                })

            },

            myaddshemes(){
                this.offerfrom.offerList = this.dbuspros;
                this.dbuspros.forEach((item,i)=>{
                    this.offerfrom.offerList[i].offerdetailNum=item.busproNum;
                    this.offerfrom.offerList[i].offerdetailTotal=item.busproTotal;
                    this.offerfrom.offerList[i].offerdetailDeiscount=item.busproDeiscount;
                })
                this.offerfrom.busPrimarycontact=this.businessform.busPrimarycontact;
                this.offerfrom.client = this.businessform.client;
                this.offerfrom.business = this.businessform;


                this.$axios.post("http://localhost:8088/offer/addOffer",this.offerfrom).then(()=>{

                    this.selectOfferBybusId(this.businessform.busId);
                    this.offershow=false;
                    this.$message({
                        type: 'success',
                        message: '新增成功!'
                    });
                    this.init();
                    this.offerfrom.offerTheme='';
                    this.offerfrom.offerNote='';
                    this.offerfrom.offerExamine={
                        empId:0,
                        empName:''
                    }
                });
            },

            /*设置报价客户是否接受*/
            setaccpe(row){
                var statu = row.offerAudit;
                if(statu=="未审核"){
                    this.$confirm('该商机未审核！', '提示', {
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning',
                        center: true
                    })
                }else{
                    this.$axios.post("http://localhost:8088/offer/editofferAccept",this.qs.stringify({
                        offerId:row.offerId
                    })).then(()=>{

                        this.selectOfferBybusId(this.businessform.busId);
                        this.$message({
                            type: 'success',
                            message: '修改成功!'
                        });


                        //this.reload();
                    }).catch(()=>{

                    })
                }

            },
            /*添加解决方案*/
            addscheme(viod){
                this.$refs[viod].validate((valid) => {
                    if(valid){
                        if(this.schemefrom.schemeId>0){
                            this.$message({
                                type: 'success',
                                message: '修改成功!'
                            });
                            this.myaddscheme();
                        }else {

                            this.verifymyscheme();
                            if(!this.myschemeflag){
                                this.myaddscheme();
                            }
                            this.$message({
                                type: 'success',
                                message: '新增成功!'
                            });
                        }
                    }else {
                        return false;
                    }
                })

            },

            /*验证解决方案主题名称是否存在*/
            verifymyscheme(){
                this.$axios.post("http://localhost:8088/business/scheme/verifymyscheme",this.qs.stringify({
                    schemeTheme:this.schemefrom.schemeTheme})).then(v=>{
                        if(v.data){
                            this.myschemeflag = true;
                            this.$message({
                                showClose: true,
                                message: '该主题已存在',
                                type: 'warning'
                            });
                        }
                }).catch(()=>{

                })

            },

            myaddscheme(){
                this.buspeople();
                this.schemefrom.busId.busId=this.businessform.busId;
                this.$axios.post("http://localhost:8088/business/scheme/addscheme",this.schemefrom).then(()=>{
                    this.selectscheme(this.schemefrom.busId.busId);

                    this.init();

                    this.schemefrom={
                        schemeId:0,
                        schemeTheme:'',
                        schemeRecord:'',
                        schemeFeedback:'',
                    }

                });
                this.schemeshow=false;
                this.myclientflag=false;
            },

            /*编辑解决方案*/
            editscheme(item){
                this.myclientflag=true;
                this.schemeshow=true;
                this.vieflag=!this.vieflag;
                if(item.schemeType=='客户需求'){
                    this.vieflag=true;
                }else{
                    this.vieflag=false;
                }
                this.schemefrom = JSON.parse(JSON.stringify(item));
                this.changedemand();

            },

            /*显示添加产品方法*/
            showaddprotab(){
                this.addprotankuan=true;
                this.$axios.post("http://localhost:8088/business/selectprodetails",this.qs.stringify({
                    currentpage:this.currentPage,pagesize:this.pagesize,
                    proName:this.prosss
                })).then((v)=>{
                    this.producttab=v.data.rows;
                    this.pagetotal=v.data.total;

                }).catch(()=>{

                })
            },
            /*显示关联联系人方法*/
            showaddlxr(){
                this.addalr=true;
            },
            /*更改联系人方法*/
            viewdata(a){
                this.init();
                this.linkmantables=[];
                this.$axios.post("http://localhost:8088/business/selectmainlinkman",this.qs.stringify({
                    search:a,linkmanName:this.linkmanposs
                })).then((v)=>{
                    this.alllinkmantable=v.data;
                    this.alllinkmantable.forEach((b,i)=>{
                        if(this.businessform.busPrimarycontact.linkmanId==b.linkmanId){
                            this.linkmantables.splice(i,0,b);
                        }

                    })


                    }).catch(()=>{

                })
            },

            //选中联系人 储存联系人的id
            retainId(linkmanId){
                this.cclinkmanId=linkmanId;
            },

            /*确认修改*/
            editlinkman(a){
                this.$axios.post("http://localhost:8088/business/editlinkman",this.qs.stringify({
                    busId:a,
                    linkmanId:this.cclinkmanId
                })).then(()=>{
                    this.addalr=false;
                    this.$message({
                        type: 'success',
                        message: '修改成功!'
                    });
                    //刷新页面
                    this.viewdata(this.businessform.client.clientId);
                    //this.reload();
                }).catch(()=>{

                })
            },


            /*查询的产品方法*/
            editprodata(busId){
                this.$axios.post("http://localhost:8088/buspro/selectbuspro",this.qs.stringify({
                    busId:busId
                }))
                    .then((v)=>{
                        this.dbuspros=v.data;
                        this.discount();
                    }).catch(()=>{

                })
            },

            /*客户编辑表格*/
            showprotab(){
                this.jilutankuan=true;
                this.proList=[];
                this.dbuspros.forEach((a,i)=>{
                    this.proList.splice(i,0,JSON.parse(JSON.stringify(a)))
                })
                this.insidebuspro();

            },

            /*点击进度方法*/
            handleClick(tab, event) {
                window.console.log(tab, event);

                if(tab.name=='fourth'){
                    this.getNowTime();
                }
                if(tab.name=='five'){
                    this.prosize=this.businessform.dbuspros.length;

                }
                if(tab.name=='seven'){
                    this.initofferNumbers();
                }
                if(tab.name=='six'){
                    this.viewdata(this.businessform.client.clientId);
                }

            },

            /*编辑产品删除方法*/
            detpro(row){
                this.proList.forEach((pur,i)=>{
                    if(pur.prodetailId==row.prodetailId){
                        this.proList.splice(i,1);
                    }
                })
                this.insidebuspro();

            },

            /*计算编辑产品总计*/
            insidebuspro(){
                var count=0;
                this.proList.forEach((v)=>{
                    if(v.busproDeiscount==''){
                        v.busproDeiscount=100;
                    }
                    var lir = v.prodetailSpri*(v.busproDeiscount/100);
                    if(lir<v.prodetaiJpri){
                        v.busproDeiscount=100;
                        this.$message({
                            message: '折扣太低，亏本了！',
                            type: 'warning'
                        });
                    }

                    v.busproTotal=this.numFilter((v.prodetailSpri*(parseFloat(v.busproDeiscount)/100))*v.busproNum);
                    count=this.numFilter(parseFloat(count)+parseFloat(v.busproTotal));
                })
                this.aggregate=count;
            },


            /*添加产品到编辑产品判断*/
            addpros(){
                var flag = false;
                this.$refs.multipleSelection.selection.forEach((pro,i)=>{
                        flag = false;
                        if(this.proList.length !=0){
                            this.proList.forEach((list)=>{
                                if(pro.prodetailId==list.prodetailId){
                                    this.$confirm('此产品已经存在，如需添加请直接修改数量!', '提示', {
                                        confirmButtonText: '确定',
                                        cancelButtonText: '取消',
                                        type: 'warning',
                                        center: true
                                    }).then(() => {
                                    }).catch(() => {
                                    });
                                    flag=true
                                }

                            })

                        }
                        if(flag==false){
                            //不存在产品,则可以添加
                            console.log("不存在产品1")
                            this.addList(pro,i);
                        }

                        this.addprotankuan=false;

                })
                this.insidebuspro();
            },

            //添加的产品的方法
            addList(pro,i){
                this.$set(pro,'busproNum',1);//数量
                this.$set(pro,'busproTotal',pro.prodetailSpri);//小计
                this.$set(pro,'busproDeiscount',100);//折扣
                this.proList.splice(i,0,pro);
            },


            /*修改产品详情*/
            editpros() {
                var busform=JSON.stringify({busfrom:this.businessform,dbuspros:this.proList})
                this.$axios.post("http://localhost:8088/business/addbusiness",this.qs.stringify({busfrom:busform})).then(() => {
                    this.editprodata(this.businessform.busId)
                    this.jilutankuan=false;
                    this.discount();
                    this.$message({
                        type: 'success',
                        message: '编辑产品成功!'
                    });
                }).catch(() => {
                });
            },

            //添加产品复选框选中的
            handleSelectionChange(val) {
                this.multipleSelection = val;//  this.multipleSelection 选中的值

            },

            //编辑产品复选框选中的
            oneSelectionChange(val){
                this.multipleTable=val;//  this.multipleTable 选中的值
            },


            /*产品当前页方法*/
            handleCurrentChange(val) {
                window.console.log(`当前页: ${val}`);
                this.currentPage=val;
                this.showaddprotab()
            },

            /*删除编辑产品表格选择的*/
            editdetpros(){
                this.multipleTable.forEach((v)=>{
                    this.proList.forEach((item,j)=>{
                        if(item.busproId==v.busproId){
                            this.proList.splice(j,1);
                        }
                    })
                })
                this.insidebuspro();
            },


            //计算外层折扣金额
            discount(){
                var count = 0;
                var jinjia=0;
                this.dbuspros.forEach((v)=>{
                    v.busproTotal=this.numFilter(v.prodetailSpri*(parseFloat(v.busproDeiscount)/100)*v.busproNum);
                    count=this.numFilter(parseFloat(count)+parseFloat(v.busproTotal));
                    jinjia=jinjia+(parseFloat(v.prodetaiJpri)*v.busproNum);
                })
                this.outcount = count;

                this.offerfrom.offerProfit=count-jinjia;
                this.offerfrom.offerMoney=count;
            },


            //查询该商机所有报价
            selectOfferBybusId(a){
                this.$axios.post("http://localhost:8088/offer/selectOfferBybusId",this.qs.stringify({
                    busId:a
                })).then((v)=>{
                        this.offerList=v.data;
                        this.offerList.forEach(v=>{
                            if(v.offerAccept=="已接受"){
                                this.weiwei=true;
                                this.ofshow=false;
                            }
                        })

                    }).catch(()=>{

                })
                /*查询审批人*/
                this.$axios.post("http://localhost:8088/offer/selectapprove").then((v)=>{
                    this.appofferOptions=v.data;
                    this.print("我是审批人");
                    this.print(this.appofferOptions);
                }).catch(()=>{

                })

            },



            /*自动生成单号*/
            initofferNumbers() {
                var date = new Date();
                var year = date.getFullYear();
                var month = date.getMonth() + 1;
                var day = date.getDate();
                if (month < 10) {
                    month = "0" + month;
                }
                if (day < 10) {
                    day = "0" + day;
                }
                //使用年月日作为中间数
                var busnosj = year + month + day;

                //使用时间戳作为最后五位随机数
                var a = date.getTime() + "";
                var b = a.substring(8, 13);

                //最后编号
                var offerNumbers = "O_" + busnosj + "_" + b;
                this.offerfrom.offerNumbers = offerNumbers;
            },


            /*去掉小数点*/
            numFilter (value) {
                let realVal = ''
                if (!isNaN(value) && value!== '') {
                    // 截取当前数据到小数点后两位
                    realVal = parseFloat(value).toFixed(2)
                } else {
                    realVal = '--'
                }
                return realVal
            },


            /*默认今天*/
            getNowTime() {
                var now = new Date();
                var year = now.getFullYear(); //得到年份
                var month = now.getMonth(); //得到月份
                var date = now.getDate(); //得到日期
                month = month + 1;
                month = month.toString().padStart(2, "0");
                date = date.toString().padStart(2, "0");
                var defaultDate = `${year}-${month}-${date}`;
                this.$set(this.needfrom, "needNowtime", defaultDate);
                this.$set(this.schemefrom, "schemeNowtime", defaultDate);
            },

            /*初始化阶段*/
            inphase(){
                this.$axios.post("http://localhost:8088/business/phase").then(v=>{
                    window.console.log(v.data);
                    this.phaseoptions=v.data;
                }).catch(()=>{

                })
            },
        },


        computed:{


        },
        created: function () {
            this.init();
        },
        filters: {
            formatDate: function (time) {
                if (time != null && time != "") {
                    var date = new Date(time);
                    return formatTimeToStr(date, "yyyy-MM-dd");
                } else {
                    return "";
                }
            }
        }
    }
</script>

<style scoped>

    .demo-table-expand {
        font-size: 0;
    }
    .demo-table-expand label {
        width: 90px;
        color: #BFBFBF;
    }
    .demo-table-expand .el-form-item {
        margin-right: 0;
        margin-bottom: 0;
        width: 100%;
    }

    a{
        text-decoration: none;
        color: #409EFF;
    }
    a:hover{
        color: black;
        cursor: pointer;
    }
    /*/deep/ .el-scrollbar__wrap {
        overflow: scroll;
        width: 120%;
        height: 100%;
    }*/
    [data-v-299b8cf2] .el-scrollbar__wrap{
        width: 100%;
    }

    .apro:hover {
        color: #409EFF;
        cursor: pointer;
    }
    #setting{
        cursor: pointer;
    }
    .li{
        border-bottom: 1px dashed #d3d3d6;
        width: 96%;
        margin: 0 auto;
    }
    .moButton{
        text-align: center;
        margin-top: 10px;
    }
    .el-tag + .el-tag {
        margin-left: 10px;
        margin-top: 5px;
    }

</style>